JavaScript: Validate a mandatory field, using the onclick event

JavaScript: Validate a mandatory field, using the onclick event

Hi everybody

I want Validate a mandatory field, using the on click event on save button.

I just have two mandatory fields on my form, They are on Input type...

However i have some errors in my java script code.

Any help?

Thanks on advance

Telmo Lopes

Hi Telmo


The Agile Platform already includes some built-in server and client side validators, which allows you to check if a mandatory field is filled in, and with the correct data type. What type of validation are you trying to do on those fields?


Can you place the javascript of the on click event you«re using in the forums? Maybe we can identify the cause of the error.






Miguel João

Hi Miguel.

Actually I'm using the 4.0 Version of the Service Studio...

I want assign the validation on the button that save the form. I'm tring to assign a onclick extend property on my button, and i add that code in the value:


if(document.getElementById('wtInputMesIPCref').value = "")
return confirm('Preencha o campo MesIPCref');
return false;

if(document.getElementById('wtInputAnoIPCref').value = "")
return confirm('Preencha o campo AnoIPCref');
return false;"

I just want validate that when i save the form, the input field, wtInputMesIPCref and wtInputAnoIPCref, that are of integer type, is not avoid that they are empty, and returns a message...

Thanks on advance.

Best regards.

Telmo Lopes

Any Idea??

what does alert('[' + document.getElementById('wtInputMesIPCref').value + ']'); produce, if you try that?

then you can see if you even get the expected value.