How to do text field validation and load specific pages?

Hello All,

I have a simple requirement, I have an input field for e-mails and depending on the e-mails I need to redirect the user to a specific page (another appsmith project / or another page in the same project).

Eg :- From Home page input —> If E-mail is “abc@def.com” => Load Page 2 / E-mail is def@abc.com => Load Page 3

Is there any tutorial on how to do this? Any help is appreciated.

@o2d You can do this using the below snippet

{{Input1.text == 'email1' ? navigateTo('Page1') : Input1.text == 'email2' ? navigateTo('Page2') : navigateTo('Page3')}}

Hi Danica,
Where exactly should I run this snippet?

@o2d, you can write JS on different properties of widgets using the mustache syntax. In your case, you can drag and drop a button for the UI and copy the above JS code on the button’s onClick property.

1 Like