Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Need Help with Signature Field

_Win_Lam_
Level 2
Level 2
Hi.



Can someone kind help me with this:



I have 3 questions with a Yes/No radio button answer.



If all 3 buttons are "No", then i would need to have my signature image as "visible" and another radio button status turned on/selected.



How may i do this? i need serious help......!
13 Replies
Thomas_McConnac
Level 4
Level 4
if (radioGroup1.rawValue == "No" && radioGroup2.rawValue == "No" && radioGroup3.rawValue == "No")

{

signature.presence = "visible";



//Note the single '=' here, not the '=='

radioGroup3.rawValue = "Yes";

}

else

{

// Hidden is removed from the layout, invisible is there in the layout but a blank space

signature.presence = "hidden";



//Note the single '=' here, not the '=='

radioGroup3.rawValue = "No";

}



I would put it in the change event for each radio group.
_Win_Lam_
Level 2
Level 2
Hi Thomas, Thanks for your advice....

I've tried to plot the script and changing it's name values to that of the fields, but it doesn't seem to work.



Can you also explain to me what's the difference between "==" and "="?
Thomas_McConnac
Level 4
Level 4
"==" is an expression, or a test so will return either true, or false depending on if the test comes back as true (e.g. 1 == 1 returns true, 1 == 2 returns false)

"=" is setting the value of the field and will return true if it manages to set the value (I have several times put in only a single "=" by mistake and spent a long time wondering why it seemed to be doing somethign when it shouldn't)



As for not working, check what the radio groups are returning as their raw values by using:



xfa.host.messageBox("" +radioGroup1.rawValue );



It might be set to associate the radio's with a numerical value (In the Object > Binding tab).



Tom
_Win_Lam_
Level 2
Level 2
Dear Tom,

May I know if i can set a submit button to print the form at the same time with only 1 button?

1 more question, on the script above, y would we need to include the last script (radioGroup3.rawValue = "Yes";) at the last?
_Win_Lam_
Level 2
Level 2
Hey Tom!!!! i got it working!!!! thanks! 😛
_Win_Lam_
Level 2
Level 2
I've even got the print solution done!!! Thanks! 🙂
Thomas_McConnac
Level 4
Level 4
Hey Win,



Setting the (radioGroup3.rawValue = "Yes") was what I thought you wanted it to do. Maybe you just wanted to make that visible too? 🙂



Glad you got it working,



Tom
_Win_Lam_
Level 2
Level 2
Yes, Tom... my mistake...



'But i have another problem....



i have a "clear form" button on it.. is there a way to remove or hide the signature when user clicks "clear form"?



i've tried entering the script Image1.presence = "hidden"; after the defaulted "xfa.host.resetData()" onto the click event, it doesn't clear the form anymore...



Lastly, may i know if i can enter more "if" statement on the same event? for eg:



if (Rdo_Q1.rawValue == "N" && Rdo_Q2.rawValue == "N" && Rdo_Q3.rawValue == "N" && Rdo_Q4.rawValue == "N")

{

Im_Jye.presence = "visible";



}



else



{

Im_Jye.presence = "hidden";



}



if (Rdo_Q1.rawValue == "Y" && Rdo_Q2.rawValue == "Y" && Rdo_Q3.rawValue == "Y" && Rdo_Q4.rawValue == "Y")

{

Rdo_Off.rawvalue = "Y"



}



else



{

Rdo_Off.rawvalue = "null";



}
Thomas_McConnac
Level 4
Level 4
Not sure what you mean by the signature and I don't know much about them yet, but for if's they work like this:



if (statement1)

{

// Do stuff 1

}

else if (statement2)

{

// Do stuff 2

}

else

{

// Do stuff 3

}



This will look at statement1 and execute the first "Do stuff 1" if it is true, if it is false it will test against statement2.



If this is true it will execute the second "Do stuff 2", if this is false it will then execute the else section "Do stuff 3".
Thomas_McConnac
Level 4
Level 4
Oh and you can have as many "else if" statements as you want and don't have to include and "else" if you don't need one.



Regards,



Tom
_Win_Lam_
Level 2
Level 2
Hi Tom,

when i clear data with a reset data button, my image remains visible. so i want to hide it whenever the reset data button is clicked. what i did was, i entered the script Im_Jye.presence = "hidden"; onto the click event of the reset data button after an existing script "xfa.host.resetdata();"



the button becomes redundant....



can you help please? thank you...