Hello, I am new to the forums and I have looked for solutions to this issue for two days now and I know it HAS to be something simple.
I am trying to make an onclick for a table cell that will do an if/else... This is for a registration form I am working on.
Basically I have a registration form setup for a LAN party so people who are going can register and pick their seat. In this form the "Pick your seat" field is a link to open a hidden table which is the seating chart on which you can click the seat you want and it puts the seat number into the form for you.
The seating chart is database driven with two fields per entry Seat_Number, Seat_Status and Seat_Name. Using php I created a array of hidden form inputs below the registration page to make a text input with the id of check_(seatnumb er) and the value of (whatever that seat number value is)
Looks like this:
ok.. So normally you can click on a table element and choose your seat with this code...
which works great and puts 67 into the form text input with the "id" of "seat"
Because you can click on any seat with the above code it allows you to choose a seat that is already reserved. I am trying to use an if/else statement below to check the array of seatnumbers - seatstatus input boxes and take the appropriate action.... Here is the code..
But it does not work at all.. It lets you choose the seat if it is reserved or not... I can reverse this and have it be as follows:
and all it does is give the alert message no matter if its open or reserved...
I am at my wits end on this and I am rather a n00b to javascripting and such so.. Can someone help me please... pretty please with c++ on top?
I am trying to make an onclick for a table cell that will do an if/else... This is for a registration form I am working on.
Basically I have a registration form setup for a LAN party so people who are going can register and pick their seat. In this form the "Pick your seat" field is a link to open a hidden table which is the seating chart on which you can click the seat you want and it puts the seat number into the form for you.
The seating chart is database driven with two fields per entry Seat_Number, Seat_Status and Seat_Name. Using php I created a array of hidden form inputs below the registration page to make a text input with the id of check_(seatnumb er) and the value of (whatever that seat number value is)
Looks like this:
Code:
<input name="1" id="check_1" type="hidden" value="open" /><br /><input name="2" id="check_2" type="hidden" value="open" /><br /><input name="3" id="check_3" type="hidden" value="open" /><br /><input name="4" id="check_4" type="hidden" value="open" /><br /><input name="5" id="check_5" type="hidden" value="open" /><br /><input name="6" id="check_6" type="hidden" value="open" /><br /><input name="7" id="check_7" type="hidden" value="open" /><br /><input name="8" id="check_8" type="hidden" value="open" /><br /><input name="9" id="check_9" type="hidden" value="open" /><br /><input name="10" id="check_10" type="hidden" value="open" /><br /><input name="11" id="check_11" type="hidden" value="open" /><br /><input name="12" id="check_12" type="hidden" value="open" /><br /><input name="13" id="check_13" type="hidden" value="reserved" /><br /><input name="14" id="check_14" type="hidden" value="reserved" /><br /><input name="15" id="check_15" type="hidden" value="reserved" /><br /><input name="16" id="check_16" type="hidden" value="reserved" /><br /><input name="17" id="check_17" type="hidden" value="open" /><br /><input name="18" id="check_18" type="hidden" value="open" /><br /><input name="19" id="check_19" type="hidden" value="open" /><br /><input name="20" id="check_20" type="hidden" value="open" /><br /><input name="21" id="check_21" type="hidden" value="open" /><br /><input name="22" id="check_22" type="hidden" value="open" /><br /><input name="23" id="check_23" type="hidden" value="open" /><br /><input name="24" id="check_24" type="hidden" value="open" /><br /><input name="25" id="check_25" type="hidden" value="open" /><br /><input name="26" id="check_26" type="hidden" value="open" /><br /><input name="27" id="check_27" type="hidden" value="open" /><br /><input name="28" id="check_28" type="hidden" value="open" /><br /><input name="29" id="check_29" type="hidden" value="open" /><br /><input name="30" id="check_30" type="hidden" value="open" /><br /><input name="31" id="check_31" type="hidden" value="open" /><br /><input name="32" id="check_32" type="hidden" value="open" /><br /><input name="33" id="check_33" type="hidden" value="open" /><br /><input name="34" id="check_34" type="hidden" value="open" /><br /><input name="35" id="check_35" type="hidden" value="open" /><br /><input name="36" id="check_36" type="hidden" value="open" /><br /><input name="37" id="check_37" type="hidden" value="open" /><br /><input name="38" id="check_38" type="hidden" value="open" /><br /><input name="39" id="check_39" type="hidden" value="open" /><br /><input name="40" id="check_40" type="hidden" value="open" /><br /><input name="41" id="check_41" type="hidden" value="open" /><br /><input name="42" id="check_42" type="hidden" value="open" /><br /><input name="43" id="check_43" type="hidden" value="open" /><br /><input name="44" id="check_44" type="hidden" value="open" /><br /><input name="45" id="check_45" type="hidden" value="open" /><br /><input name="46" id="check_46" type="hidden" value="open" /><br /><input name="47" id="check_47" type="hidden" value="open" /><br /><input name="48" id="check_48" type="hidden" value="open" /><br /><input name="49" id="check_49" type="hidden" value="open" /><br /><input name="50" id="check_50" type="hidden" value="open" /><br /><input name="51" id="check_51" type="hidden" value="open" /><br /><input name="52" id="check_52" type="hidden" value="open" /><br /><input name="53" id="check_53" type="hidden" value="open" /><br /><input name="54" id="check_54" type="hidden" value="open" /><br /><input name="55" id="check_55" type="hidden" value="open" /><br /><input name="56" id="check_56" type="hidden" value="reserved" /><br /><input name="57" id="check_57" type="hidden" value="open" /><br /><input name="58" id="check_58" type="hidden" value="open" /><br /><input name="59" id="check_59" type="hidden" value="open" /><br /><input name="60" id="check_60" type="hidden" value="open" /><br /><input name="61" id="check_61" type="hidden" value="open" /><br /><input name="62" id="check_62" type="hidden" value="open" /><br /><input name="63" id="check_63" type="hidden" value="open" /><br /><input name="64" id="check_64" type="hidden" value="open" /><br /><input name="65" id="check_65" type="hidden" value="reserved" /><br /><input name="66" id="check_66" type="hidden" value="open" /><br /><input name="67" id="check_67" type="hidden" value="open" /><br /><input name="68" id="check_68" type="hidden" value="open" /><br /><input name="69" id="check_69" type="hidden" value="open" /><br /><input name="70" id="check_70" type="hidden" value="open" /><br /><input name="71" id="check_71" type="hidden" value="open" /><br /><input name="72" id="check_72" type="hidden" value="open" /><br /><input name="73" id="check_73" type="hidden" value="open" /><br /><input name="74" id="check_74" type="hidden" value="open" /><br /><input name="207" id="check_207" type="hidden" value="staff" /><br /><input name="206" id="check_206" type="hidden" value="staff" /><br /><input name="200" id="check_200" type="hidden" value="staff" /><br /><input name="201" id="check_201" type="hidden" value="staff" /><br /><input name="202" id="check_202" type="hidden" value="staff" /><br /><input name="203" id="check_203" type="hidden" value="staff" /><br /><input name="204" id="check_204" type="hidden" value="staff" /><br /><input name="205" id="check_205" type="hidden" value="staff" /><br /></div>
Code:
<td width="36" height="36" onclick="document.getElementById('seat').value = 67;return hs.close(this);" id="s67" onmouseover="changeMe(this,'active',name67), TagToTip('showName')" onmouseout="changeMe(this,seat67,''), UnTip()"> </td>
Because you can click on any seat with the above code it allows you to choose a seat that is already reserved. I am trying to use an if/else statement below to check the array of seatnumbers - seatstatus input boxes and take the appropriate action.... Here is the code..
Code:
onclick="if(document.getElementById('check_65').value = 'open') { document.getElementById('seat').value = 65;return hs.close(this);} else {alert( 'This seat is already reserved!' ) }"
Code:
onclick="if(document.getElementById('check_65').value = 'reserved') {alert( 'This seat is already reserved!' ) }" else { document.getElementById('seat').value = 65;return hs.close(this);}
I am at my wits end on this and I am rather a n00b to javascripting and such so.. Can someone help me please... pretty please with c++ on top?
Comment