[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

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.
0
jwilliams1
Asked:
jwilliams1
  • 3
  • 2
1 Solution
 
bin_huwairibCommented:
jwilliams1, can you explain it more?
0
 
jwilliams1Author Commented:
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.
0
 
bwoodsCommented:
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.
 
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
bwoodsCommented:
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.
0
 
bin_huwairibCommented:
jwilliams1,

You can check field content before creating the result page.

Example:

Suppose that you have two text fields the first on called "Name" and the other one called "Address" and one combo box called "State".

<table>
<%
if request(“Name”)<>”” Then
 response.write(“<td> Name : “ & request(“Name”) & “ </td>”)
end if
if request(“Address”)<>”” Then
response.write(“<td> Address : “ & request(“Address”) & “ </td>”)
end if
if request(“State”)<>”” Then
response.write(“<td> State : “ & request(“State”) & “ </td>”)
end if
%>
</table>


Best regards,
Bin Huwairib

0
 
bin_huwairibCommented:
jwilliams1,

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

Thanks
Bin Huwairib
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now