Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

formcalc: access = "protected" puts protected literal in field.

Avatar

Level 2

Hi. I have a form that has a field, EmpNbr, appearing twice. The two fields share the same name with Data Binding set to Use Global Data. I don't want the second field to be enterable so I set the field to protected using FormCalc, see clip below. When viewing the form in Preview PDF it is indeed protected, the cursor skips the field. However, both fields show the literal protected as the initial field value. Why is the literal protected being populated and how can I prevent it?

If I change the access to readOnly, that becomes the initial value.

It doesn't help if I change FC to JS.

Below is a clip of the access command --

topmostSubform.Page1.EmpNbr[1]::calculate - (FormCalc, client)

  $.access = "protected"

Thanks for any insight.

Gary

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

The calculate event is "special" and is setup to return whatever the script on the event does back to the caller (in your case the field). So if you add a $.rawValue to the end of your script it will return the current value of the field and all shoudl be good. Note that if you used a different event then this woudl not happen as Calculate is the only event that operates this way.

So your script shoudl be:

$.access = "protected"

$.rawValue

Hope that helps

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

The calculate event is "special" and is setup to return whatever the script on the event does back to the caller (in your case the field). So if you add a $.rawValue to the end of your script it will return the current value of the field and all shoudl be good. Note that if you used a different event then this woudl not happen as Calculate is the only event that operates this way.

So your script shoudl be:

$.access = "protected"

$.rawValue

Hope that helps

Paul

Avatar

Level 2

Aha! Thank you.

If only life was that simple.

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