• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help

 
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
basically you need to call
document.FormName.Submit();
which will cause the form to submit...
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I closed the other duplicate thread, you might want to look at this for reference:
https://coderanch.com/t/114497/HTML-JavaScript/Design-help
Eric
 
Shreya Menon
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mouli,
Thanks for your great help
maya
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic