Jump to content

Buttons messng up scripts


dstafford

Recommended Posts

Just getting into html so forgive the simple question...Anyone know a way to work around the following:I have a script that adds up several fields on a simple html page. when I add a submit button to pass numerous variables to another rpage and database. The script stops running. Is here a way I can use a script that also needs to submit that data to an asp page?Thanks

Link to comment
Share on other sites

not using asp.net.... IIS web server which is set to handle asp pages. Using it to gather some simple data then transfer to database. That all works fine. I added a small java script to the program to offer some onscreen totals before the data is sent to the dtabase via the asp page and it does not work. If I remove the submit button the totals work fine.

Link to comment
Share on other sites

A submit button submits the form. That's its job. You can attach a click handler to the button also, but it's going to submit that form, and how the two conflicting instructions work out is (IME) unpredictable.What you want is to handle the submission part yourself. You can make your handler an onsubmit handler or just make your submit button a regular button (type="button"). Then the last part of your display function does something like myform.submit().Now, all that's going to happen FAST, so if you want your user to see something before the page goes away, you'll need to do something like this:var t = setTimeout (myform.submit, 5000);That creates a 5 second delay during which your user can see whatever you're displaying. You might want less. It's just an example.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...