Form validations using Java Script

Form validations using Java Script

  

HI, I'm trying to use Java script in Outsystems. I'm trying to implement the form validations.


I 've a JS like

---

 function validateForm()

 {
    var x = document.forms["myForm"]["fname"].value;
    if (x == null || x == "") {
        alert("Name must be filled out");
        return false;
    }
}

----

I tried to put this code in form submit button with extended property onclick but it doesn't work

How and where do i insert the java script to validate form. Please suggest me the best way to do it.

I need to do all the validation using JS. Please tell me the correct format to insert JS code in outsystems.


Thanks,

Sathish.D

Hi Satish,

Is there any reason why you can't use the built in client side validation to handle this? Just wondering what the use case is to give you a good example of what you are trying to achieve.

Justin 

Justin Babel wrote:

Hi Satish,

Is there any reason why you can't use the built in client side validation to handle this? Just wondering what the use case is to give you a good example of what you are trying to achieve.

Justin 


Yes you are right. But I'm learning Java Scripts And How it works on Outsystems so I started with validations on forms. I know form validations in general but have no idea how to apply it on out systems.


I have tried something like this 

 Please tell me where am wrong and tell me proper and easy way to validate a forms in JS. I have also attached the oml. If possible create one sample validation for name or some other attribute in that form and send it.

Thanks.