More than one submit event problem

I have a form in <!-- m --><a class="postlink" href="http://recruit.mnetrade.com/sample_add_form.asp">http://recruit.mnetrade.com/sample_add_form.asp</a><!-- m -->

In my sample_add_form.asp, it has
<form name=myform action="sample_add_form.asp" method=post>

When I onchange my specialization drop down box, it will automatically load sample_add_form.asp and there are some code to retrieve the second drop down box.

And at the end, after I fill in all fields and click Save, the page should be sample_add.asp. So, how do I go about this? Thanks.Well there might be a better solution out there but here are two possibilities:

1) make your submit button a hyperlink which calls some javascript function. This function will take all your form values and submit them to sample_add.asp using the GET method. This involves simply redirecting to a URL with all your variables in it.
e.g. window.location = "sample_add.asp?field1=" & field1.value ....
It is a tad messy and you have to worry about escaping characters in the javascript

2) the other way is to create another form of hidden values that mirrors your real form and simply submits to sample_add.asp instead. You should remember to set their values as the field1.value and not the Request variables.

there are easier ways to do this that i have discovered, but those involve .NET =)If I understand this properly, you are submitting a form to itself and, dependant on what form values are passed into, changing some of the select options?

That's actually a pretty good way of doing it.

I'd say not toying with that and just throw your actual add function into the page once you know you have all the fields.


<%
sub myForm
'build form based on the fields passed in

end sub

sub myAdd
'run SQL to insert the record

end sub

if validateForm() then
myAdd
else
myForm
end if

function validateForm()
'run some code to see if the form has been completed properly
'return true for completed, false for not completed
end function


That would be the basic layout of your ASP.Originally posted by eRad
Well there might be a better solution out there but here are two possibilities:

1) make your submit button a hyperlink which calls some javascript function. This function will take all your form values and submit them to sample_add.asp using the GET method. This involves simply redirecting to a URL with all your variables in it.
e.g. window.location = "sample_add.asp?field1=" & field1.value ....
It is a tad messy and you have to worry about escaping characters in the javascript

2) the other way is to create another form of hidden values that mirrors your real form and simply submits to sample_add.asp instead. You should remember to set their values as the field1.value and not the Request variables.



I know the first way but will what you said, it is messy. For your second way, I can't get it yet.

That is good one, putts. I will going to try that out. Thanks you guys.
 
Back
Top