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

Required field activates after click on radio button?

Community Beginner ,
Nov 13, 2020 Nov 13, 2020

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
1.7K
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
1 ACCEPTED SOLUTION
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"]);

View solution in original post

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

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

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

group name = gilt
radio button 1 = ab sofort

radio button 2 = ab fälligkeit

 

3x textfields called:

- Tag

- Monat

- Jahr

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

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;

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

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.

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

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

 

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

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.

 

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

Add this to the code:

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

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.

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

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

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

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

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

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

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

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

Why is it "dirty"?

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 ,
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"]);

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