These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

mandatory enabling/disabling with Checkbox

poregon
Registered: Oct 27 2008
Posts: 80
Answered

The following script is assigned to a Checkbox - but when I deselect the Checkbox, the mandatory property does not activate again - the field presence for the TradePrice field does (invisible when checked, visible when unchecked), but not the mandatory action. It disables just fine, but I can't get it to re-enable, so to speak, if the user checks the box, but then later un-checks it. Is the term "enabled" wrong? Or am I not even close here.... :)

form1.Subform2.NoTrade::mouseUp - (JavaScript, client)
if (NoTrade.rawValue == 1)
{TIVID.mandatory = "disabled"
TIVIN.mandatory = "disabled"
TIMake.mandatory = "disabled"
TIModel.mandatory = "disabled"
TIModelYr.mandatory = "disabled"
TIMileage.mandatory = "disabled"
TIBalance.mandatory = "disabled"
TradePrice.mandatory = "disabled"
TradePrice.presence = "invisible"
}
else
{TIVID.mandatory = "enabled"
TIVIN.mandatory = "enabled"
TIMake.mandatory = "enabled"
TIModel.mandatory = "enabled"
TIModelYr.mandatory = "enabled"
TIMileage.mandatory = "enabled"
TIBalance.mandatory = "enabled"
TradePrice.mandatory = "enabled"
TradePrice.presence = "visible"
}

poregon
Salix, Iowa

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The legal values for the "mandatory" property are "warning", "error", or "disabled". To get your code to work change "enabled" to "error".

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

poregon
Registered: Oct 27 2008
Posts: 80
Thom - Thanks so much!
I have a few good starting references for LiveCycle, including the Live Cycle Designer Scripting Basics from the adobe site, and some others from the devnet site, but I don't have anything that gives legal values in a single reference - can you suggest anything?
All the best,
Pat

poregon
Salix, Iowa

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Do you have the "XML Form Object Model Reference?":
http://partners.adobe.com/public/developer/xml/topic.php

This doc is mandatory for working with LC forms, but it doesn't provide all the legal values for the object properties. The document is not really put together too well. So I find this stuff out through a combination of looking at all the reference docs and experimentation. I just create a form with several different variations of form fields and see what value "mandatory" returns.

BTW: If you look inside the form XML there isn't a property named "mandatory". This is just a scripting convenience. Under the covers mandatory is really the "scriptTest" attribute of the "Validate" property.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

poregon
Registered: Oct 27 2008
Posts: 80
Thanks again, Thom. I always enjoy your material on here - I bet I've watched your "Extending with JavaScript and FormCalc" eseminar a half dozen times. Love your website, too. Maybe someday I can afford full membership :)

poregon
Salix, Iowa