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

Required field activates after click on radio button?

Community Beginner ,
Nov 13, 2020 Nov 13, 2020

Copy link to clipboard

Copied

Hello,
next question,

I've two radio buttons in one group
[   ] as of now or [  ] due date        also some seperate fields for day, month and year as  [M][M][D][D][Y][Y]

 

Is there a possibility, if you click on the "as of due date" button, that all text fields for the date are activated (writable + required)?

If the "writeable first" does not work, it would be good to know how to make it then a required field.

TOPICS
PDF forms

Views

712

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 1 Correct answer

Community Expert , Dec 01, 2020 Dec 01, 2020

Not sure why that's not working, but you can use this code to reset those fields to their default values:

this.resetForm(["Tag", "Monat", "Jahr"]);

Votes

Translate

Translate
Community Expert ,
Nov 13, 2020 Nov 13, 2020

Copy link to clipboard

Copied

Yes, that's possible. What are the names of the fields and the export values of the radio-button group?

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 Beginner ,
Nov 15, 2020 Nov 15, 2020

Copy link to clipboard

Copied

group name = gilt
radio button 1 = ab sofort

radio button 2 = ab fälligkeit

 

3x textfields called:

- Tag

- Monat

- Jahr

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 ,
Nov 16, 2020 Nov 16, 2020

Copy link to clipboard

Copied

You can use this code in one of the radio buttons to make fields writable and required
if you want them to be readonly and not required use same code in second radio button
just change true-false, false-true:
this.getField("Tag").required = true;
this.getField("Tag").readonly = false;
this.getField("Monat").required = true;
this.getField("Monat").readonly = false;
this.getField("Jahr").required = true;
this.getField("Jahr").readonly = false;

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 Beginner ,
Nov 16, 2020 Nov 16, 2020

Copy link to clipboard

Copied

Thank you, this works almostly. But if I click on the 2nd radio button with this required code. And going back to the first radio button, the textfield are still required.

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 ,
Nov 16, 2020 Nov 16, 2020

Copy link to clipboard

Copied

In second button change every "true" to "false" and "false" to "true":

 

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 Beginner ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

Hello,
this works very well. Thank you.

Another question is, if people click on the second radio button and type something on textfields "Tag, Monat, Jahr" but now he decide to choose the first button. But these textfields should be cleared.

 

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 ,
Nov 30, 2020 Nov 30, 2020

Copy link to clipboard

Copied

Add this to the code:

this.getField("Tag").value = "";
this.getField("Monat").value = "";
this.getField("Jahr").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
Community Beginner ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

It doesn't work. Text that has already been inserted will still remain and, as stated above in the code, the text field can no longer be edited.

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 Beginner ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

Hmm, I've just add a space between "", now its "cleared"

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 Beginner ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

but this is very dirty, another option to solve this problem without using space?

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 ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

You can try use MouseUp event of radio buttons in action tab  and choose "Reset a form" and select text fields.

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 ,
Jul 23, 2023 Jul 23, 2023

Copy link to clipboard

Copied

LATEST

hey so you've totally fixed my issue and ive been having this problem for a week now so thank you! im new to java but hoping i didn't get a head of myself with my current project. after selecting radio a specific radio button i begin typing in a text field and the coloring/styling goes away (the newely desired fields are working properly). Any ideas as to why this would be happening? Would I need to add something to the script? edit the newely exisiting one? thanks in advance!

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
Enthusiast ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

Why is it "dirty"?

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 ,
Dec 01, 2020 Dec 01, 2020

Copy link to clipboard

Copied

Not sure why that's not working, but you can use this code to reset those fields to their default values:

this.resetForm(["Tag", "Monat", "Jahr"]);

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