Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

LiveCycle Form - Need Checkbox to show/hide image

Avatar

Level 1

My checkbox is named Ucheck.  The image is named UStamp.  I need the checkbox to turn the image visible.

I've read the other forum answers and have found this example:

var showHide = event.target.isBoxChecked(0)?display.visible:display.hidden;


this.getField("Text036").display = showHide;

However, when I the above script in to my form (changinging the (getField to "Ustamp") on LiveCycle, it gives me this answer

Script failed(language is formcalc;context is

xfa[0].form[0].U-check[0].#subform[0].Ucheck[0]

script=var showHide=

event.target.isBoxChecked[0]?display.visible:display.hidden;

this.getField("Ustamp").display=showHide

Error: syntax error near token "?" on line 1, column 44.

When I take the "?" out, it says it doesn't like something else about the script.

I know NOTHING about Javascript, so haven't a clue how to debug this.  I do program in Access, but am not real familar with VB either.

Thank you for your help.....

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Did you save the form as dynamic .....under the file saveAs dialog make sure that you pick a Dynamic PDF as the type.

Paul

View solution in original post

7 Replies

Avatar

Former Community Member

The example you found is using AcroForm javascript. The script to do this would be placed on the change event of the checkbox:

if (this.rawValue == 1){

     UStamp.presence = "visible"

} else {

     UStamp.presence = "hidden"

}

This assumes that you have set you On value as 1 and your Off value as 0.

Paul

Avatar

Level 1

Yes, values are 1 and 0 respectively...

I entered this in the Javascript box

U-Check.#subform[0].Ucheck::change - (FormCalc, client)

if

(this.rawValue == 1){

UStamp.presence

= "visible"

}

else {

UStamp.presence

= "hidden"

}

What I get now is

Script failed (language is formcalc; context is

xfa[0].form[0].U-Check[0].#subform[0].Ucheck[0]

script=if (this.rawValue==1){

     UStamp.presence="visible"

}else{

     UStamp.presence="hidden"

}

Error: syntax error near token "{" on line 1, column 24.

I tried taking out the "{"'s and it really doesn't like that either...

Avatar

Former Community Member

That is Javascript and you have the script set for FormCalc .....In teh Script editor on the right side is the language preference .....change that from Form

Calc to Javascript.

paul

Avatar

Level 1

Okay.... I saw that and changed it just now, but now it doesn't give me an error message, it just doesn't do anything...

Boy I hate being ignorant...

Jan L. Sons

Engineering Tech

Marathon Oil Co.

Cody Office

307.587.2059

Avatar

Correct answer by
Former Community Member

Did you save the form as dynamic .....under the file saveAs dialog make sure that you pick a Dynamic PDF as the type.

Paul

Avatar

Level 1

You are WONDERFUL.... thank you so much.

If you need some help with Access... just whistle...

Jan L. Sons

Engineering Tech

Marathon Oil Co.

Cody Office

307.587.2059

Avatar

Level 1

Neophite goofs:

Didn't change window on left from Formcalc to Javascript

Didn't know about saving as a Dynamic Form.

After correcting both of these, I am now in business...

thank you so very much...

Bless You...

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----