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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two actions in one click.

Status
Not open for further replies.

chags

Programmer
Dec 4, 2000
12
US
Hi,

By clicking next button it has to update the database and should show next page. For which I writtern the following code

<A HREF=&quot;/servlet/SFAWhatNextServlet?Request=rerun&quot; onclick=&quot;return checkSaveState(formname)&quot;>Image</A>

In which the methode checkSaveState(formname) has the following code

.....
var status = document.forms[0].element[&quot;to_save_any&quot;].value;
if(status == &quot;yes&quot;)
{
document.forms[0].submit();
}
return true;
......

Actually after submitting it usually takes atleast 30seconds to update database . But immediately with in a second after the submit command, it is returning true and executing

HREF=&quot;/servlet/SFAWhatNextServlet?Request=rerun&quot;

by stopping submit action.

ie. in one step it is doing two actions. So How I can complete submit command(for completing submit it takes 30sec ) and then it has to execute HREF. If anyone suggest any alternative or any solution to same code will be appreciated.

Thanks in advance
chags
 
-> either populate the db in your servlet - thus you call directly the next page, and this is the next page that is in charge of populating the db - this is the &quot;logical&quot; way to do it !!!
-> or do as you woud do for a &quot;normal&quot; form : call the function to populate the db ONSUBMIT and set the form action to be the servlet : <form name= method= action=&quot;/servlets/SFA...&quot; onsubmit=&quot;javascript:the function to populate the db&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top