| Author |
Help
|
Shreya Menon
Ranch Hand
Joined: Jul 31, 2001
Posts: 285
|
|
All, All suggestions welcome for designing this: 1. Have a web page with tabs [4 tabs] in the body and 2 menu links on the left side. The requirement is if I modify anything in my page and click on the tabs, I should prompt the user to do a form submit before proceeding. But on the same time, if I am clicking on the menu links I should do a form auto submit. How can I accomplish this ? Thanks
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
basically you need to call document.FormName.Submit(); which will cause the form to submit...
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
I closed the other duplicate thread, you might want to look at this for reference: http://www.coderanch.com/t/114497/HTML-JavaScript/Design-help Eric
|
 |
Shreya Menon
Ranch Hand
Joined: Jul 31, 2001
Posts: 285
|
|
Eric, document.formname.submit only submits the form... How do I distinguish betwween tabs and menu links ? Mouli, I added a hidden variable and didnt give a value. Lets say that I am adding a function callme() for onchange event of the form. function callme() { alert("calling"); form1.clicked.value="Y"; form1.action="xxx.html"; } Now when the user clicks on the tab or click on the menu, there is another javascript function function check() { } //But I cannot get the modified value of the hidden variable here.. Thanks
|
 |
ChandraMouli Vidiyala
Greenhorn
Joined: Dec 19, 2002
Posts: 12
|
|
Shreya, Hope this code will do for u. <html> <head> <script> function assignValue(){ //alert(document.myform.myName.value); document.myform.isFormDataChanged.value="Y"; } function handleTabClick(){ //alert(document.myform.isFormDataChanged.value); if(document.myform.isFormDataChanged.value == 'Y') alert("Please do the form submit first..."); else { document.myform.action="abc.html"; document.myform.submit(); } } function handleMenuClick(){ //alert(document.myform.isFormDataChanged.value); document.myform.action="abc.html"; document.myform.submit(); } </script> </head> <body> <form name="myform"> <a href="javascript:handleTabClick();">Tab1</a> <a href="javascript:handleTabClick();">Tab2</a> <a href="javascript:handleMenuClick();">Menu1</a> <a href="javascript:handleMenuClick();">Menu2</a> <br><br> <input type="hidden" name="isFormDataChanged" value="N"> <input type="text" name="myName" value="" onkeydown="javascript:assignValue();"> </form> </body> </html> -Mouli
|
 |
Shreya Menon
Ranch Hand
Joined: Jul 31, 2001
Posts: 285
|
|
Mouli, Thanks for your great help maya
|
 |
 |
|
|
subject: Help
|
|
|