Link to home
Start Free TrialLog in
Avatar of jwilliams1
jwilliams1

asked on

Form Collection

I have form that collects information and sends it to database using ASP.  

I am submitting a form and I want to show the student what he/she submitted.

I used:
 = Request.form("Name")

My form has some fields (combo boxes) that will never be filled out at the same time, so how do I make the form submit only those results that are filled in?
You help is greatly appreciated.
Avatar of bin_huwairib
bin_huwairib

jwilliams1, can you explain it more?
Avatar of jwilliams1

ASKER

I want to make a results page that only returns those results that are entered on the form, so that the student has an account of what he/she entered.
Keep up with which combo boxes are changed.  It's personal choice what type of variables, etc. to use to do this.  One possible way is to use an array with one element for each combo box to hold flags for whether the matching combo box is changed or not.

'for example
'**at form module level or public in a common module
private m_ChangedArray(1 to however_many_comboboxes_you've_got) as boolean
  Then, add code to the combo box events (I would have made these combo boxes an array, and used defined constants to determine which combo box was being accessed. You can do it with individually named combo boxes, but you will have lots of duplicate code, as you will have to put code in every combobox's events).  The events that you will want to monitor are ComboBox_Changed and/or ComboBox_LostFocus.  I usually just do lost focus, as I have found the combobox's Changed event to be a little flaky.  When it loses focus, check to see if they changed it.  If so, m_ChangedArray(Index_that_corresponds_to_this_CB) = true.
  Later, when they hit the SUBMIT button or whatever action you have supplied, check the m_ChangedArray values and only send data from the comboBoxes that have changed.

Like Bin_Huwairib, I'm not sure if this is what you are asking, so this may or may not be what you need.  If it guides you to a solution, let me know and I'll lock it. Otherwise, please clarify further.
 
PS  Another answer, if they will NEVER fill out more than one combo box at a time, is to put an array of option buttons on the form, one above each combo box.  When they select the option button above a combo box, enable it and disable the others.  In order to use a combo box, they have to "Turn it on".  When the action occurs that signals it's time to submit, check and see which option button is selected, and only send the data from its matching combobox.
ASKER CERTIFIED SOLUTION
Avatar of bin_huwairib
bin_huwairib

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
jwilliams1,

Please correct the lines that contain the tag <td> to
response.write("<tr><td> ... </td></tr>”)

Thanks
Bin Huwairib