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

using javascript to make a text box invisible by clicking a radiobutton

Avatar

Level 2
hi



my radiobuttons are for a persons title eg Mr Miss Mrs Ms and value 5 is for other.



when i click other i want a text box to appear that a user can write in, and if the user changes their mind after writing in the box i want the text box to disappear



you may of noticed i am new to java. this is the code i have used for my text box



topmostSubform.Page1.titleother::calculate - (JavaScript, client)



if (titlebox.rawValue == 5)

this.presence = "visible";

else

this.presence = "invisible";



this.rawValue;



i have tried variations of this script but it still doesnt work the way it should. i tried searching forums and help files but couild not find an answer to this simple problem... can anyone help
2 Replies

Avatar

Level 4
Hi,



Its likely that the radio buttons are returning "other" instead of 5.



Try this line in your code to check:



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



It will bring up a prompt with the value in.



Tom

Avatar

Level 2
thnaks for your post thomas i appreciate your help on this 🙂



yes it did put 'other' in my text box.



i managed to overcome the proble using a workaround, it isnt ideal but it works. i put a clickevent in the radiobuttons and changed the text box from calculated to optional