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

Trying to validate a check box

New Here ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

Creating a form for people to sign up for an item.  I have a check box called "Gold", and I have a description of the line item and a price, say $100 on the form.  On the line next to the price is a text box that I want populated as 100 when the check mark is checked.  Can this be done and how?

TOPICS
PDF forms

Views

933

Translate

Translate

Report

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

correct answers 2 Correct answers

Community Expert , Aug 21, 2021 Aug 21, 2021

There are various ways you can achieve this with a script.

 

In the example below, I am using a Custom Calculation script, and I placed the script in the text field where the 100 value should appear into when checkbox "Gold" is checked.

 

var g = this.getField("Gold");

if (g.value !== "Off") {

event.value = g.value;

} else {

event.value = "";

}

 

Votes

Translate

Translate
Community Expert , Aug 21, 2021 Aug 21, 2021

Start with these :

 

 

And keep coming back to the forums with questions.

 

You'll get plenty of  valuable guidance from the developers in these forums.

Votes

Translate

Translate
Community Expert ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

Yes, but should the text field be editable for the user? Also, what should it show when the check-box is not ticked?

Votes

Translate

Translate

Report

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
New Here ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

It should be blank.  It's a sign up sheet.  So if they check the box, there's a price associated with that line. 

 

I want it to automatically place the price into the text box:

 

__  Sign up for dinner.  $50.  $_______

 

The __ is a check box.  When it's checked I want 50 to appear on the line (there's a text box there)

Votes

Translate

Translate

Report

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 ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

There are various ways you can achieve this with a script.

 

In the example below, I am using a Custom Calculation script, and I placed the script in the text field where the 100 value should appear into when checkbox "Gold" is checked.

 

var g = this.getField("Gold");

if (g.value !== "Off") {

event.value = g.value;

} else {

event.value = "";

}

 

Votes

Translate

Translate

Report

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
New Here ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

Thank you

Votes

Translate

Translate

Report

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
New Here ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

Is there a book of commands or a way to learn these java scripts that someone can recommend???

Votes

Translate

Translate

Report

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 ,
Aug 21, 2021 Aug 21, 2021

Copy link to clipboard

Copied

Start with these :

 

 

And keep coming back to the forums with questions.

 

You'll get plenty of  valuable guidance from the developers in these forums.

Votes

Translate

Translate

Report

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
New Here ,
Aug 22, 2021 Aug 22, 2021

Copy link to clipboard

Copied

Thank you

Votes

Translate

Translate

Report

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 ,
Aug 22, 2021 Aug 22, 2021

Copy link to clipboard

Copied

LATEST

You're welcome.

Votes

Translate

Translate

Report

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