75
Views
6
Comments
Solved
Client Side Validation Framework - Integration with external libraries
Question

Hi All,

I am looking for options to have client side validation framework to address following requirements:

  1. It should be async
  2. It should allow me to review all the validations at one single place. Add/remove if required
  3. It should be reusable. Something built for React web app should be used in mobile apps as well.

I was looking at the existing validations available in the platform and did not find them to meet requirements #2 and #3 from above. 

Can someone help me confirm if my understanding is correct?

If that is correct,

  1. Is there a way to make changes to the existing framework achieve something like this?
  2. Has anyone done validate.js or similar integration? I am trying to do this using validate.js but somehow not able to make it work.

Please let me know if I haven't properly explained my problem.


Thank you,

Akshay

mvp_badge
MVP
Rank: #19
Solution

Hi Akshay,

I had a look at it, I think the problem is that your JS code adds a validation hook on the submit of the form.

So line 72 is hit but line 74 never when I debugged. This means that there is never a form submit happening, and thus the handleFormSubmit() function that does the actual validation never runs.

I change it to catch the click of the save button:

This will now start the validation, but you have more issues in your JS code, I think you use underscore.js library?

_ object is not loaded.

PS, why all this trouble to do some simple basic validation which you can easily do with low-code OutSystems?

Regards,

Daniel

mvp_badge
MVP
Rank: #19

Hi Akshay,

1. Yes, OutSystems is a develop platform. You can build your custom validation yourself, extending the building validation features.

2. You say you tried but failed. If you could share more info on where you got stuck than maybe someone can help you with that. Share code by screenprints, error messages or even better an .oap file of your application.

Regards,

Daniel


Rank: #492

Thank you Daniël for responding. I have attached here the oml of what I did. I will try to explain.

  1. I have added 3 fields on my form email, password, date and kept them optional so that OutSystems framewrok do not trigger it's flow.
  2. I have added validator.js and other required libraries to the module
  3. Also added custom script to use validate.js and write validation logic for field types including email, password, date etc.
  4. The issue I am facing here is that they are not triggered and I am not seeing the validations work.

Could you please check and suggest where am I going wrong? Also, if there is a better way of doing it that will be great.

Thanks for your help again :)

TestCert.oml

mvp_badge
MVP
Rank: #19
Solution

Hi Akshay,

I had a look at it, I think the problem is that your JS code adds a validation hook on the submit of the form.

So line 72 is hit but line 74 never when I debugged. This means that there is never a form submit happening, and thus the handleFormSubmit() function that does the actual validation never runs.

I change it to catch the click of the save button:

This will now start the validation, but you have more issues in your JS code, I think you use underscore.js library?

_ object is not loaded.

PS, why all this trouble to do some simple basic validation which you can easily do with low-code OutSystems?

Regards,

Daniel

Rank: #492

Thank you, Daniel for helping out on this part. Yeah I have been trying to convince my customer about the out of the box support of OutSystems validation framework, but they are used to seeing the externalized frameworks usually done in traditional coding. So they want to see all the validations at one place, in a single file :)

Rank: #492

Hi Daniel,

Do you have some example like this with you? Thanks.

Rank: #492

I am also looking to do this for server side as well.