How to call javascript function on button click

Hello All,

I have button to save data on sql server. I have written javascript to validate some of the field, when I click on button i have to check validation first if all the field data in proper format then server side button click event should be fired.So how to call client side as well as server side methods for single button.

Thanks and regards,
 Pradip Chavhan
Hi Pradip,

In every button/Link you have the property Validation this method can be set to one of the following 3 options:
·        Server
·        Client & Server
·        None
As for the Server option there will be no client side validation and all the validation checks should be written in your Save action.

The Client & Server option will validate two aspects Client side: Mandatory fields and Datatypes. If these two aspects are seem valid then the server part of this validation will run and behave the same as if you would chose the Server option.

If you want to read anything more about how to validate End-User Inputs check this link:

Regarding your question: "How to call JavaScript function on Button Click" There are some ways to do this but the easiest way is the action "RunJavaScript" in the "HTTPRequestHandler" extension. 
Then you can do stuff like this:

Kind Regards,
Martijn Habraken
Hi Pradip,

Don't forget to return True from Javascript, as returning False will not call the Server-side action.

Without adding this extension, simply i want to call javascript function on button click

How should i do. I tried using button control i add javascript function also in extended properties i have added "onClick" client side event.

But still button behaviour required server side action.

I dont want to add this server function. 

Can we do it?

Hi Pradip, 

I have a hard time understanding why you would not want to use the standard building blocks supplied by the platform to make things easier for you. Validating fields or the correct corelation of these fields is not something that I would want to create custom javascript for but be handled by the platform itself using the widgets available. This is improves readability. 

But to answer your question; To run javascript at runtime you need to use the "RunJavaScript" in the "HTTPRequestHandler" module as Martijn already said.