This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Help" Watch "Help" New topic
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: 15376
    
    6
basically you need to call
document.FormName.Submit();
which will cause the form to submit...
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help
 
Similar Threads
Struts Menu Question
Design help
Struts & Tiles frame work issue
JSP <a href> tags breaks page functionality
How can I have a TAB inside my JSP