Copy link to clipboard
I have a multi-page form that requires the user's name in numerous blanks. I have named all such fields the same (“Name”) so that when the user fills in the first field all the others are also filled in. However, there is one such blank down in the pack where the user might very occasionally want to leave the field blank or type in different information.
I am new to this, but I have created a button the user can hit and make the one selected field go blank, allowing the user to then either leave it blank or type in new information, without effecting the other fields.
To do this I have cobbled together the following code:
event.value = this.getField("Name").valueAsString
4. In the actions tab of the button I put the following two scripts
Surely to goodness there is a simpler, more straight forward way to do this. What is it? It's bothering me.
Thank you very, very much in advance for your assistance.
Copy link to clipboard
You have to give it a different name, like Name1. You also have to think about how it's going to work.
For example, if the user enters something into Name, should it populate Name1 automatically? What about if Name1 already has a value? Should it overwrite it, or not?
I did give it a different name, and in fact used, "Name1." I want "Name1" to be populated automaticlly when the other "Name" fields are filled in so that unless the user hits the button the "Name1" field acts as if it were a "Name" field.
Using the code I developed, the "Name1" field cannot be overwritten manually. If you go in and delete what was previously put in automatically (and either write somehing new or leave it blank) the original information returns when you leave the field.
I had not thought about overwriting what's automatically there. Upon further thought I would prefer that the user not be able to change the field manually, as it might encourage the user to try the same thing on another "Name" field and that would change all the "Name" fields.
When the user hits the button, the "Name1" field goes blank and acts afterwards as if were a brand new totally new and separate empty field. Until that happens the "Name1" field acts is as if it were just another "Name" field.
Thank you very much for your attention.
Remove the code you added and add the following as the custom Validation script of Name:
if (event.value) this.getField("Name1").value = event.value;
Thanks, but you're above my pay grade. I built a simple one page sample and moved the code all over the place. I'll just let the issue pass, stick with my clumbsy method, and get out of your hair.
Thanks again. Stay safe.
All you had to do was copy the code I provided, but OK...