473,388 Members | 1,499 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

how to validate with two different submit in struts

kaleeswaran
132 100+
hi!
i am validating my form.the form has two different submit button like "SAVE" and "UPDATE" button.but i don't know how to different validatation while i clicking save button and update button.how to differentiate the function calling...?
thank you,
kaleeswaran
Dec 6 '07 #1
1 1483
hi!
i am validating my form.the form has two different submit button like "SAVE" and "UPDATE" button.but i don't know how to different validatation while i clicking save button and update button.how to differentiate the function calling...?
thank you,
kaleeswaran
You could change the action with javascript to point to different validating actions depending on what you click

struts-config:

<form path=/ValidateUpdate" validate="true" type="myClass" name="myForm" scope="request"/>
<form path=/ValidateSave" validate="true" type="myClass" name="myForm" scope="request"/>


jsp:

<html:form onsubmit="return getAction(this)" method="post" action="/ValidateSave">
<html:hidden name="myForm" property="submitValue"/>
<html:button onclick="setSubmitValue('save')" name="myForm" property="save" value="save"/>
<html:button onclick="setSubmitValue('update')" name="myForm" property="update" value="update"/>
</html:form>

js

function getAction(f){
var submitVal = document.getElementById("submitValue").value;
if(submitVal=='update')
f.action.value = "/ValidateUpdate.do";
else
f.action.value = "/ValidateSave.do";
return true;

}

function setSubmitValue(val){
document.getElementById("submitValue").value = val;
}
Dec 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: sancha | last post by:
Hi, i am in a bit of a delima here. I need to submit an action through javascript so i used document.forms.action='/search.do?&submitaction=Add Minus' document.forms.submit(); since i am...
1
by: stellabein | last post by:
Hi friends, I am very very new to programing. i have a one main window from that window i am opening one modal window using showmodaldialog(m.jp...). in that modal window i have a form. when i...
1
by: marco | last post by:
Hi, I have this problem : when I submit a Form with the usual <html:form name="myForm" action="/myAction" type="org.apache.struts.validator.DynaValidatorActionForm"> ...... <input...
4
by: owingruters | last post by:
Hi all, I've created an User control. It's an extension of a textbox wich has some extra properties so that validation becomes a lot faster. The control wordks great if autopostback is on....
11
by: wolf | last post by:
There are three webcontrol on my asp.net form: a TextBox, a submit button and a RegularExpressionValidator. And I had set ControlToValidate property of the RegularExpressionValidator to the...
5
by: holy moly | last post by:
Hello, I have been trying to get this JS form validation code to work ad nauseam... it won't validate, stop if required and submit. The best I managed was to get it to display an empty...
2
by: Kevin Audleman | last post by:
Hi, is it possible to create a form that has two submit buttons, and each one submits to a different page? Thanks, Kevin
31
by: ajos | last post by:
hi frnds, i have a form,which has 2 input text boxes, the values are entering the text boxes,when i leave the 2 text boxes blank and hit submit a java script gives the message that the 2 fields are...
1
by: IframeLearner | last post by:
Hi , I am trying to upload a file from a parent.jsp using Iframes. From Parent page. I have to save Subject, Desc, File and file name. to upload the file i am using Iframe. I want the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.