197
Views
10
Comments
how to create an form with validation ?
Question

hi team 

how to create an form with validation ?

in that form we have name, email, phone we need to validate that.

Don't give the actual data type like we give email as a data type as email , instead of that use if conditions to validate the email & name (only allow the char there is no special char & number)& phone number(only allow number no special char & text). these are all we have to validate in only if . 

2023-03-16 16-29-51
Paulo Rosário

Hello Vijay, 

I didn't see your update! 

If you drag an entity to a screen Outsystmes will automatedly create a form with a simple validation for the mandatory fields of that entity.

After that, you can access the Save action and add custom verifications there: 

For more information on how to Validate forms you can check out these links : 

Form Validations 

Validate Form Inputs

Hope it helps! 

Paulo Rosário

UserImage.jpg
vijay kumar

Hi paulo,

thanks for the answer , actually  but i need to do in if condition format so that the requirement

2023-03-16 16-29-51
Paulo Rosário

The validations are done with an If condition, could you elaborate more? 


2019-09-24 18-41-25
Jorge Martins
 
MVP

Hi @Vijay Kumar 

What @Paulo Rosário explained is how you perform validations in OutSystems: for each validation you have an If node and test that condition, if it fails you assign values to the input's Valid and ValidationMessage to make sure the user will be aware of them. In the end you check whether the form is Valid.

If you want to restrict what the user can input, then you need to use Forge components like (in no particular order): Input Mask Reactive, Input Masks Library, InputMask React. Or use JavaScript libraries directly to help you with that. You can also see if handling the OnChange event of your Input widget would be enough for your needs.

Hope this helps!

UserImage.jpg
vijay kumar

hi Paulo ,

Actually i need to check each and every input 

1. Name - in that name no mandatory propriety and data type is text but we don't need the special character & integers.

2. phone  -no mandatory propriety and data type is text but we don't need the alphabets and special characters

3. email - in email no mandatory propriety and data type is text but we need special char like @ , .

2022-05-02 13-50-49
Paulo Ritto

Hi, you can use the RegexInput forge component, really easy to use, you can select the option onlyAlphabetic for Name, for phone you can select onlyNumeric, and for email you can put your own regexPattern that only allows letters and @.

Regex Input forge component: https://www.outsystems.com/forge/component-overview/12976/regexinput

With this component, you won't have to make any if validations, as the user will only be able to enter the specific chars you want, on each field.


Cheers,

Paulo


2022-12-07 04-24-30
Neha Lawange

Hello Vijay,

For validating name ,email and phone number :You can use Regex_search server action for each input field.

For email,name-You can use following flow:For name Pattern:"^[a-zA-Z\s]*$"

For Phone number you can check condition:

Length(UDetails.PhoneNumber) = 10 and Pattern will be : "[^0-9]" 

I hope this will help you.


Regards,

Neha

2023-06-15 06-47-16
Monica Anne Laurente

Thank you so much! This helped me

2022-03-08 06-34-45
swapnil powar

Hi vijay 

If you have phone number and data type is text , and if you want to accept only a number then use Regex_Search function in onchange event of input and provide following values.

Text- current aggegate value for phone number

Pattern- "[^0-9]"

and check if result found from Regex_Search with if condition, if true then use valid and validationmessage property of widget accordingly.

Hope this will help.

Regards,

Swapnil Powar

2024-09-12 02-43-38
Deepsagar Dubey

Hi Vijay,

It can be done automatically by Outsystems you just need to check Form.Valid property,

Keep in mind that if any of the field validation fails then form validation automatically be false, By default it'll check field data type and mandatory in validation,

You can also create custom validation.

Thanks

Deep 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.