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

User entered Variables

Not applicable
I am trying to create a form in LiveCycle 8 where a user who has the form open can enter in information, and that information then populates into different locations on the page.

Say that there is a drawing of a door. I'd like there to be a form where they enter the width and height, and those numbers that they enter are then put in their corresponding location on the drawing. Any help would be great!!
11 Replies
pmcalex
Level 2
Level 2
Set the default binding (in the Object palette, binding tab) of the text field where the user enters data to Global.

Then create other text fields with that same name and place anywhere you want that user entered data to appear.

Once the user types in data it will also appear in corresponding locations.

Hope this helps!
Not applicable
Thanks! That was just what I needed!!
Not applicable
Okay. So now how about this. Is there an easy way to take a user entered variable and subtract a number from it?



Example. The user enters in 38" in a field. Then in another field the result is displayed, which would be whatever they entered minus 2"? (36)
Not applicable
In the calculate event of that second field, write this:



this.rawValue = OTHER_FIELD_NAME.rawValue - 2;



you can get the OTHER_FIELD_NAME by clicking in the script editing window and than holding CTRL as you hover your mouse over the field you're pulling the value from. You should see a little black arrow show up when you hover over the field. Click when it's over the field you're looking for and it's name will show up in the scripting window. It will look a little something like this"

xfa.resolveNode("form1.#subform[0].#subform[1].TextField1[0]")



Don't forget to reset the binding to "Normal" or the change will also affect the OTHER_FIELD_NAME - that and since you're calculating on the event, you'll create a loop that will run the calculation over and over.
Not applicable
Thanks! That worked out well. I took it several steps further. I'm trying to have a form figure out the radius of something when the users enter in the width and the rise. I got it to work most of the way, but on my final piece of script I get this message:



"Script failed (language is formcalc; context is xfa[0].form[0].form1[0].#subform[0].NumericField6[0])

script=this.rawValue=form1.#subform[0].NumericField4.rawValue / form1.#subform[0].NumericField5.rawValue

Error: arithmetic over/underflow"



That's what I get. The formula still works though. The only thing that I can think of is that it's erroring because there's no value in the field until the user puts one in there. Am I close? Any thoughts on fixing that? Thanks!
Not applicable
Well I've had no luck in fixing this error. Anyone?
_Bill_Bain_
Level 4
Level 4
I don't know whether you've correctly identified the source of your error, but why not, as a trial, set the denominator value to 1 as a default so that when the calculate event trips there will be a value in the field before the user enters one?
Not applicable
Well that's where the conundrum comes in. I did go in and set the value. Not to 1, but to some standard sizes. The same thing happened. No idea. But then I'm all very new to this.
Not applicable
Chris, the binding you mentioned above helped me... but how would i make it so when someone checks a box on my form the 'name' or 'caption' of the object could be populated in another area? My form is for users requesting computer access and there are 20+ systems to choose from i would like the systems they pick to populate in an area for print. Any info would be very helpful thanks.
Not applicable
I'm sorry. I have no idea. Hopefully someone online here can help us out. I'm still hoping that someone can figure out why I might be getting this message:



"Script failed (language is formcalc; context is xfa[0].form[0].form1[0].#subform[0].NumericField6[0])

script=this.rawValue=form1.#subform[0].NumericField4.rawValue / form1.#subform[0].NumericField5.rawValue

Error: arithmetic over/underflow"



Chris
JeffBinTN
Level 1
Level 1

I had something similar and it was because the denominator was a zero before the user entered the variables.  It was fixed with an "if/then/endif".

It looks like the problem in yours is form1 being zero.  Try

if([YOUR DENOMINATOR]>0)then[YOUR FORMULA HERE]endif

Example:

if(form1>0)then(this.rawValue=form1.#subform[0].NumericField4.rawValue / form1.#subform[0].NumericField5.rawValue)endif

Your formula is a bit more complicated than I can decipher, so I'm not sure how much after the "/" you need to include to capture the part of your denominator that is making it null.  You may need to insert everything after the "/" in the ">0" parameter.  The goal is to tell it only to execute the calculation when the denominator is greater than 0.