Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Copy a text field based on checkbox value

Community Beginner ,
Jan 10, 2023 Jan 10, 2023

I would like to copy selection based on if a check box is selected. How can I do this. I have attached a screenshot of what I am wanting. 

The user will slect the time they need our service on Monday. I have a box they can select if it is the same all week. If so I would like the rest of the days to auto populate to match monday. 

 

I want the same thing for sunday. 

TOPICS
JavaScript , PDF forms
3.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2023 Jan 10, 2023

Here is a basic script as 'Mouse UP' action of checkbox:

if(event.target.value != "Off"){
this.getField("Tuesday").value = this.getField("Monday").value;
this.getField("Wednesday").value = this.getField("Monday").value;
this.getField("Thursday").value = this.getField("Monday").value;
this.getField("Friday").value = this.getField("Monday").value;}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2023 Jan 10, 2023

Thank you so much. I'm new to Java. This is a very dumb question. Where do I put this? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2023 Jan 10, 2023

Also do I post the entire script you sent me?

 

Would it be the same for the 2nd checkbox? If they check the box under saturday I want it to autopopulate sunday. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2023 Jan 10, 2023

I tried it but I guess Im doing it wrong. Not sure how to make it work. I attached the file if that helps. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2023 Jan 10, 2023

Script is in checkbox → Properties → Actions Tab → Select trigger: Mouse UP → Select action: Run a JavaScript.

Here is your file with scripts added:

https://drive.google.com/file/d/1zLtUrXzGPPJKvVeEw0zRTBvNL-UQL_Fg/view?usp=share_link 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2023 Jan 10, 2023

You are amazing! Is there a way to make the To line populate to. Both to and from? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2023 Jan 10, 2023

Forgot attachement...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2023 Jan 10, 2023
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2023 Jan 10, 2023

This is perfect. One last thing. Is it possible to make the checkboxes abvoe the other days check as well? If so I would like them to be checked if they select same all week or same saturday and sunday. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2023 Jan 10, 2023

Sure, do you also want to add if checkbox is unchecked to revert field values to default?

EDIT:

Here you go https://drive.google.com/file/d/1O2dyMQcDtPa9868MH-aHO76b7AYWM4qk/view?usp=share_link 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2023 Jan 10, 2023

I'm not sure what that means. If the check box is unchecked that means the user should fill out each day. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2023 Jan 10, 2023
LATEST

This is PERFECT. Thank you. I want to learn how to do this. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines