user2917284
user2917284

Reputation: 1

Calling Javascript function on submit a form using struts2

I want to check certain conditions by using a javascript function in a jsp page when the user submits the form. I am using struts2.

I tried the following:

<s:submit action="finalSubmitOfServices" value="Submit" onclick="return fnConfirmSubmit()" />

and the javascript is like..

function fnCheckPendingValue()
    {
          //code
    }

But its not working, I am not sure how to solve this, Would really appreciate someone's help.

Thanks.

Upvotes: 0

Views: 4367

Answers (1)

Vinoth Krishnan
Vinoth Krishnan

Reputation: 2949

First change your function name to fnConfirmSubmit() as Andrea Ligios said. And still if its not working write your function in onsubmit of form. Hope you got it.

Upvotes: 3

Related Questions