Expand my Community achievements bar.

Scripting Assistance Needed

Avatar

Level 2

I'm working on a form.  What I need it to do is this:

The end user will check a box to add comments.  The comments field is NOT visable until the check box is checked.  Once the checkbox is checked then a text box will appear directly underneath it.

Thank you in advance!

SRenae

8 Replies

Avatar

Former Community Member

if (myCheckbox.rawValue == 1)

     myTextbox.presence="visible"

else

     myTextbox.presence="hidden"

Avatar

Level 2

Thank you for your quick reply!  :-)  I'm getting an error message now.  The error reads Couldn't post data to ".

Any idea why?

Avatar

Level 2

This is the form I'm creating.

THANK YOU!!  :-)

Avatar

Former Community Member

myTextbox is an "example" name of the text field you are trying to hide/display.

where on the form is it?

if you have not yet added it to the page, the add it under your check box (or whereever)

you can name it whatever you want.

then the code would be

thenameofyourtextfield.presence.......

Avatar

Level 2

do you mean where are the textbox and checkbox located on my form or in the hierarchy?

I have the checkbox and textbox in their own subform.

if

(Checkbox1.rawValue==1)

     Textfield1.presence

="visible"

else

Textfield1.presence

="hidden"

Sorry that I'm being a pain!  I'm not well-versed in scripting if that isn't obvious!  ;-)

Avatar

Former Community Member

i do not see a comments field anywhere in your hierarchy.

to get the right text box you can your a "ctrl" shortcut

when you are in the code window for your checkbox (make sure the cursor is active in the code area i.e. the little line is blinking)

then hold ctrl and click on the text field you want to use

(when you hold ctrl the cursor will turn into a little triangle thing)

hope i didn't confuse you.

Avatar

Level 2

I got it!  The language was running at the server not the client.

Your code worked perfectly!!  Thank you so much!  I just might be posting more out here now!  :-)

S