Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Make a sub form visible

Avatar

Level 5

Good Day All

Thansk to a number of folks I now have a working form..... I guess you can teach ann old dog a new trick (sometimes) ;>)

Good Day All;

Anyway.... The last part (to make it look nice), there are 3 sections of the form that should only be visual and mandatory if the user selects something other that a “u” from a drop down.

So in other words if a user selects

If the user selects “n or u ” from a dropdown at the top of the form , “scope_subform”  is to become visible and the field also becomes manatory.

Below is what I tried and it did not work. I am getting this error for the java consol.

“syntax error

23:XFA:form1[0]:#subform[0]:status_subform[0]:Table3[0]:Row1[0]:d_d_scope_1[0]:exit”

Under the dropdown “binding” the “item values” are

Value                      Text

1                                             I

2                                             u

3                                             n

( this.rawValue == 1 )

{

scope_subform.presence = "hidden"

}

else

{

Scope_subform.presence = "visible"

= "";

}

Thanks all

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

The other thing you can do is in the script editor you can hit the Syntax checker button (book with a checkmark on it) and it will point out the offending line as well.

Paul

View solution in original post

5 Replies

Avatar

Former Community Member

Why do you have the = ""; as the 2nd last line ....that does not make sense. Remove it and try again.

Paul

Avatar

Level 5

Thanks Paul. Not sure what that little end piece was doing in there….

Anyway, removed the little piece and this is ther error I got with the Java consol

syntax error

20:XFA:form1[0]:#subform[0]:status_subform[0]:Table3[0]:Row1[0]:d_d_scope_1[0]:exit

This is the full code I was using for this field. What is interesting is, I lose the color selected for the drop down when I changed the value.

switch (this.rawValue)

{

    case "1":

    this.font.fill.color.value = "0,255,0";

    break;

   

    case "2":

    this.font.fill.color.value = "255,215,0";

    break;

   

    case "3":

    this.font.fill.color.value = "255,0,0";

    break;

}

( this.rawValue == 1 )

{

scope_subform.presence = "hidden"

}

else

{

Scope_subform.presence = "visible"

}</script>

Chomp

Avatar

Former Community Member

The 20 at the beginning of the error message indicates the line where the error is. In this case you have not put the "if" in the expression before the (this.rawValue == 1). This is causing a syntax error where the } ends.

Paul

Avatar

Correct answer by
Former Community Member

The other thing you can do is in the script editor you can hit the Syntax checker button (book with a checkmark on it) and it will point out the offending line as well.

Paul

Avatar

Level 5

Thanks Paul... With your help I got it working. Works like a charm

Thanks Again for all your help

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] ----