Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submission of Dynamic Form

Status
Not open for further replies.

scottydd

IS-IT--Management
Sep 19, 2002
31
0
0
US
I'm kinda new at asp/js and i was wondering if anyone could help me...I have created a form with 2 drop down list, the first one pulls from a sql database and that option populates the second which also pulls from the database.

The problem i am having is to get this to work i submited the form to the same page, which works fine, but what i need is a button to submit the form to another page. Is this possible?

I would appriciate any help...Thank you
Scott
 
I'm assuming you have set the ACTION of your form to the current page, or possibly it is even blank (which will post to the same page).

Simply change the ACTION of the form to point to a new page containing your processing/response page.

Code:
<form action=&quot;process.asp&quot; method=&quot;post&quot;...>

In the &quot;process.asp&quot; page you can get the Request object and see what the user posted to your script. :)

Pete.


Lotus Notes Web Developer / Aptrix (LWWCM) Consultant
w: e: Pete.Raleigh(at)lclimited.co.uk
 

Scott,

Sure it is... put an extra button in your form which changes the form action before submitting the form, and some extra javascript at the top:

Code:
<script language=&quot;javascript&quot;>
<!--
  function alternateSubmit()
  {
    document.forms['yourFormName'].action = 'newurl.asp';
    document.forms['yourFormName'].submit();
  }
//-->
</script>

...

<input type=&quot;button&quot; value=&quot;Alternate submit&quot; onClick=&quot;alternateSubmit();&quot;>

And that should work OK.

Hope this helps!

Dan
 
I think I misread the question... I think Dan might be on the right track. :)

Pete.


Lotus Notes Web Developer / Aptrix (LWWCM) Consultant
w: e: Pete.Raleigh(at)lclimited.co.uk
 
Dan, Thanks so much...it works great
 
If i use this method of submission, is it still possible to do form validation?
 
Yes - you should be able to. Just perform a function call to the validation script before you do anything else. If it fails, return false to the onclick function.

If it passes, continue with the submission. :)

Code:
if(FormValidated()) {
  // continue with rest of functions
  ... other functions go here ...
} else {
  return false;
}

Pete.


Lotus Notes Web Developer / Aptrix (LWWCM) Consultant
w: e: Pete.Raleigh(at)lclimited.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top