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

Text field doesnt auto populate and it requires click the text field

New Here ,
Apr 15, 2025 Apr 15, 2025

Hi,

Would like to ask what could be the issue of my form file. 
Lets start with various question having a radio button that has value once clicked. Then each question have another text field that has javascript that gets the value of what u have chose. Then, I have this another box that shows the summation of addition of specific question (in here I only used the built in function calculate of pdf forms). The last is my concern, since it has a javascript condition when the total score reached below 15 it should produce "X" value and when the total reached above 15 it should produce "Z" value. my concern was i need to click/enter the said text field so that the value "X" or "Z" should appear. Is there a way that it could automatically flowdown without clicking or entering? 


Thanks! 

TOPICS
JavaScript , PDF , PDF forms
378
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Apr 16, 2025 Apr 16, 2025

That's because you placed the code under the Mouse Up event (which is what we asked you about...).  Move it to the field's Calculation event, and change it to the following:

 

var Ratio = this.getField("FCIK").value;

if (Ratio >=15){
event.value = 'X';
}else if (Ratio < 15){
event.value = 'Y';
}

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 ,
Apr 21, 2025 Apr 21, 2025

This line is incorrect:

else if (Number(Ratio)=0) {

It should be:

else if (Number(Ratio)==0) {

 

If it still doesn't work share your file, please.

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 ,
Apr 15, 2025 Apr 15, 2025

Where do you use the script?

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 ,
Apr 15, 2025 Apr 15, 2025

I used the script here   The last is my concern, since it has a javascript condition when the total score reached below 15 it should produce "X" value and when the total reached above 15 it should produce "Z" value. 

Just to add I dont use an application, it is pure PDF form. 

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 ,
Apr 15, 2025 Apr 15, 2025

Under what event did you place it, is the question...

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 ,
Apr 16, 2025 Apr 16, 2025

in the event where the summation is already completed and requires to perform a condition if the said total met specific requirement. Im not sure if I answered your question correctly but i can post my pdf at least? 

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 ,
Apr 16, 2025 Apr 16, 2025

No, we mean the actual event of the field: Calculation, Validation, Mouse Up, On Blur, etc.

It would be easier if you could share the actual file with us.

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 ,
Apr 16, 2025 Apr 16, 2025

Hi,

I created a prototype of my forms created. So to use this I just need to select values from section A and B. Then the total should be placed below. Lastly, my specific concern was the Result portion. The field adjacent to him wasn't reflecting automatically. My work-around here was to manually click the text field box. My question was is there any way that the result should flow down automatically? like there's no clicking needed on it? Thanks

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 ,
Apr 16, 2025 Apr 16, 2025

That's because you placed the code under the Mouse Up event (which is what we asked you about...).  Move it to the field's Calculation event, and change it to the following:

 

var Ratio = this.getField("FCIK").value;

if (Ratio >=15){
event.value = 'X';
}else if (Ratio < 15){
event.value = 'Y';
}
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 ,
Apr 16, 2025 Apr 16, 2025

Thanks! Big help!

 

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 ,
Apr 20, 2025 Apr 20, 2025

Sir is there any possible way to remove the default answer of the field to blanks? 

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 ,
Apr 21, 2025 Apr 21, 2025

Yes. Use this:

 

var Ratio = this.getField("FCIK").valueAsString;
if (Ratio=="") {
	event.value = "";
} else if (Number(Ratio)>=15) {
	event.value = 'X';
} else if (Number(Ratio)<15) {
	event.value = 'Y';
}
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 ,
Apr 21, 2025 Apr 21, 2025

eirene_7691_0-1745224330329.png

Im still encountering a default Y value. Havent selected any in the choice above. id like to have a blank since i havent selected any. I tried revising what you have placed to 
var Ratio = this.getField("FCIK").valueAsString;
if (Ratio=="") {
event.value = " ";

not working as well. 
} else if (Number(Ratio)=0) {
event.value = '0';
} else if (Number(Ratio)>=15) {
event.value = 'X';
} else if (Number(Ratio)<15) {
event.value = 'Y';
}

 

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 ,
Apr 21, 2025 Apr 21, 2025

This line is incorrect:

else if (Number(Ratio)=0) {

It should be:

else if (Number(Ratio)==0) {

 

If it still doesn't work share your file, please.

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 ,
Apr 21, 2025 Apr 21, 2025
LATEST

Thanks for this sir!I just did 0 as default. Thanks again

 

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