Siva,

Don't declare the action path, if u want validate before submitting the form to 
action class.

Declare the action path in the script itself.

Regards

Sunil

-----Original Message-----
From: sivaks75 [mailto:sivakumar.subbura...@verizonwireless.com]
Sent: Tuesday, June 21, 2011 11:14 AM
To: user@struts.apache.org
Subject: Html:link Javascript validation

Hi,

I wanted to perform javascript validation when HTML link is clicked. If
validation fails, I want to stop the process. In Javascript function, i
added return false. so that it stops the process.

When I was running the application, after performing the javascript
validation (though Layout ID is NULL), it throwed alert message and invoked
the action also which i was not expecting.

How do we stop the process if javascript validation fails?

<html:link style="font-weight: bold; font-size:11; background:none"
target="_blank" paramId="layoutID" paramName="frmEmailLayout"
paramProperty="layoutID" action="emaillayout.do?function=viewHTML"
onClick="validateLayout()"> View File as HTML </html:link>

function validateLayoutID(){
        var1 = document.forms[0].layoutID.value;

        if(var1==""){
                alert("Layout ID cannot be empty");
                document.forms[0].layoutID.focus();
                return false;
        }
}

Any help appreciated!

Regards,
Siva

--
View this message in context: 
http://struts.1045723.n5.nabble.com/Html-link-Javascript-validation-tp4509339p4509339.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


The information contained in this e-mail message and any attachments is 
confidential, and is intended only for the use of the party to whom it is 
addressed. This message and any attachments herein are subject to scanning and 
may be monitored at any time for review.  If you are not the above-named 
intended recipient, you are hereby notified that any dissemination, copying or 
disclosure of this communication is strictly prohibited. If you have received 
this communication in error, please notify XIUS immediately by reply to this 
message or by telephoning (781) 904-5000, and destroy this message and its 
attachments, without making any copy or distribution.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to