SpaceMonkey
11-22-2003, 10:23 AM
Hi All,
I am building an ASP web application which is a hotel reservation form. I am using Javascript to validate and submit the form. The forms structure changes depending on the users inputs, therefore, the name and number of fields make it very difficult to code. The section of the form which deals with the rooms looks like:
For each room:
<input type="hidden" name="rm1id" value="1">
<input type="hidden" name="rm1beds" value="1">
<input type="text" name="rm1" size="4" maxlength="2" value="0"> Single Rooms required<br>
The number for rm1id, rm1beds and rm1 is generated by a counter.
The value for rm1id is the database number for the room.
The value for rm1beds is the number of people the room can hold.
The name form rm1 is generated via the database.
After all the rooms have been displayed there is one more field which looks like:
<input type="hidden" name="numofrooms" value="3">
Where the value is generated by the counter.
On submit I need to check that the rooms hold enough people.
Therefore, I need a total which goes through each room and multiply's the rm?beds by rm? and adds it to the total.
Once I have a grandtotal, I need to check that it is greater that an ASP Session Variable which is Session("PartySize").
I have been trying for 4 days and just cannot get my head around this. Can anyone help?
Much Appreciated
SpaceMonkey
I am building an ASP web application which is a hotel reservation form. I am using Javascript to validate and submit the form. The forms structure changes depending on the users inputs, therefore, the name and number of fields make it very difficult to code. The section of the form which deals with the rooms looks like:
For each room:
<input type="hidden" name="rm1id" value="1">
<input type="hidden" name="rm1beds" value="1">
<input type="text" name="rm1" size="4" maxlength="2" value="0"> Single Rooms required<br>
The number for rm1id, rm1beds and rm1 is generated by a counter.
The value for rm1id is the database number for the room.
The value for rm1beds is the number of people the room can hold.
The name form rm1 is generated via the database.
After all the rooms have been displayed there is one more field which looks like:
<input type="hidden" name="numofrooms" value="3">
Where the value is generated by the counter.
On submit I need to check that the rooms hold enough people.
Therefore, I need a total which goes through each room and multiply's the rm?beds by rm? and adds it to the total.
Once I have a grandtotal, I need to check that it is greater that an ASP Session Variable which is Session("PartySize").
I have been trying for 4 days and just cannot get my head around this. Can anyone help?
Much Appreciated
SpaceMonkey