I am trying to develop a Registration Screen where the client must enter their Email Address twice.
I am using java script validation code which is under the OK button as below:
if (value.textinput1 = value.textinput3)
{
container5.setHidden(false)
}
else
{
container4.setHidden(false);
}
I am showing a screen shot. The code does not generate any error messages but it does not work.
Messages should come up as per the 2 containers that are shown in the second screen shot.
ScottR
August 3, 2023, 5:14pm
2
You can use Validation on the second field and disable the OK button if it doesn't validate
Scott:
Your idea works. Thank you very much.
But there is also a password entry. I need some way of getting "if" statements under the OK button so I can deal with various eventualities and put up appropriate messages.
Mike
if(value.textinput1 = value.textinput3)
using ==
instead of =
here. Recommend to us JsonShema Form component here which come with validation.
I added the extra = sign but the processor can't make sense of the code.
See the error message in the attached picture.
Mike
Hello, I think you use form wrap email, and password fields, right?
If so the path value.textInput1
is not right. It should be formname.textInput1
.
Here is my screenshot and full json app, you can upload to create app to check.
if (form1.data.email == form1.data.emailAddressAgain)
{
container1.setHidden(false);
container2.setHidden(true);
}
else
{
container1.setHidden(true);
container2.setHidden(false);
}
test (2).json (17.0 KB)
Ansong:
It works perfectly!!!
I was using a container instead of a form and this seems to make a big difference.
I have never used forms or run scripts before so this has really moved me up the learning curve. I can use this type of code in a number of places.
Thank you so much for helping me with this. I will mark this as a Solution.
Mike
1 Like
Anson:
I have tried to expand this by including a test for length. Now it seems to have fallen apart.
Could you check the block of code at the top which is checking for length. I think I have done something wrong here.
if (form1.data.email1.length < 8)
{container5.setHidden(false);
container4.setHidden(false);
container6.setHidden(true);
}
else if
(form1.data.email1 == form1.data.email2)
{
container5.setHidden(true);
container4.setHidden(false);
container6.setHidden(false);
localStorage.setValue('pwemail1', form1.data.email1);
localStorage.setValue('mGoGo', 'Yes');
}
else
{
container5.setHidden(false);
container4.setHidden(true);
container6.setHidden(false);
}
Mike
Hi mike, could your share you app json, pls remember to remove the sensitive data before share.
I would like to debug it.
You also can use debug of retool yourself to see what error appear and the state(or value) of components.
Anson:
OK, I have shared my app (Test02) with an email that has gone to the community.
I hope you get it OK.
I looked for the Debug button and was not able to find it.
Mike
Hi, I don't received your email. You can upload json file here?
Anson:
The email address is here.
https://doncaster.retool.com/editor/f7694c12-32c3-11ee-bf3a-17a291e277f7/Test02
Does this work?
Mike
No this link is point to your app editor. I have not access to it
You can export your App Here.
But remember to remove sensitive information before export.
Anson:
I tried the Export to JSON and it is asking me for a software package to do this. which doesn't work.
The JScript file that is not working is below.
if (form1.data.email1.length < 8)
{container5.setHidden(false);
container4.setHidden(false);
container6.setHidden(true);
}
else if
(form1.data.email1 == form1.data.email2)
{
container5.setHidden(true);
container4.setHidden(false);
container6.setHidden(false);
localStorage.setValue('pwemail1', form1.data.email1);
localStorage.setValue('mGoGo', 'Yes');
}
else
{
container5.setHidden(false);
container4.setHidden(true);
container6.setHidden(false);
}
Mike
Anson:
My email address is doncaster@cogeco.ca . Send me a note with your email address to me. I know how to share my app with you once I have your email address.
Mike
ScottR
August 9, 2023, 2:52pm
16
@mdsmith1
You can export to JSON using the main app list using ... button and select export to JSON and then send it / post it here
Scott:
This feature doesn't work on my computer. It asks for an app to open the JSON export. Even Visual Studio is unable to open it.
I think if I could get the email address of the community, then I would be able to Share with the community.
Mike
ScottR
August 9, 2023, 4:36pm
18
There is Retool office hours tomorrow at 2pm EST
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Check the Events channel
I have shared this app on community@retool.com
I hope some of you see this.
Mike
Tess
August 9, 2023, 8:30pm
20
Hi Mike! I'll take a look