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

Reply via email to