Changing obj.access="readOnly" to User Enter - Required at run-time

23 views
Skip to first unread message

Chris

unread,
Apr 1, 2008, 12:23:47 PM4/1/08
to Adobe LiveCycle Developers
I'm on day 2 of LiveCycle usage. Yesterday I figured out the GUI
components and today I'm working on scripting, so please forgive me if
I'm asking the obvious.

I'm experimenting with an employment application. I have a basic,
"Are you 18 or older? Yes/No If no, specify"

I have the specify object invisible by default and it becomes visible
if the 'No' is checked. I can't seem to figure out, via help files
and google, how to make the specify object required when 'No' is
checked and not required otherwise. Any pointers would be greatly
appreciated.

Below is my event code:

if (AgeYesNo == 1) then
AgeSpecify.presence = "invisible"
AgeSpecify = null
AgeSpecify.access = "readOnly"
elseif (AgeYesNo == 2) then
AgeSpecify.presence = "visible"
AgeSpecify.access = "open"
endif

Duane Nickull

unread,
Apr 1, 2008, 4:22:53 PM4/1/08
to live...@googlegroups.com
Where are you getting the values 1 and 2 from?  Usually it is a boolean value if you are using a checkbox for testing age.   Are you using a checkbox for the AgeYesNo value?  If so, modifying your script to check (probably using the onBlur() event handler) the value, then making the other filed visible/invisible based on its value is the way to go.  Your code below does not seem to have any event to start it executing. You need to kick it off, usually with an event handler.  OnBlur() is the event generated when a component loses focus so as soon as they fill in the checkbox and move the mouse to another filed, it will broadcast that event.  You can trap the event and use it to kick off your code executing.

Duane

--
**********************************************************************
"Speaking only for myself"
Senior Technical Evangelist - Adobe Systems, Inc.
Blog - http://technoracle.blogspot.com
Community Music - http://www.mix2r.com
My Band - http://www.myspace.com/22ndcentury
Adobe MAX 2008 - http://technoracle.blogspot.com/2007/08/adobe-max-2008.html
**********************************************************************

Srinath Subramanyan

unread,
Apr 2, 2008, 3:11:39 AM4/2/08
to live...@googlegroups.com
Hi Chris,
 
There is a property to set mandatory and optional with which a field can be set required.
 
To make the field required,
AgeSpecify.validate.nullTest="error"; or AgeSpecify.mandatory="error";

To make the field optional,

AgeSpecify.validate.nullTest="disabled"; or AgeSpecify.mandatory="disabled";

Srinath

--

Chris

unread,
Apr 2, 2008, 11:31:37 AM4/2/08
to Adobe LiveCycle Developers
Duane Nickull, thank you for the reply and advice. I left the
onclick event out of the cost paste. What I had did everything I
needed save for making the extra field mandatory.

Srinath Subramanyan, that is precisely what I was looking for! Thanks
much!

Duane Nickull

unread,
Apr 2, 2008, 11:33:12 AM4/2/08
to live...@googlegroups.com
Cool.  Glad you got it working now.

Maybe this group should start a code repository of examples at Google Code?

Duane

Duane Nickull

unread,
Apr 2, 2008, 12:17:13 PM4/2/08
to live...@googlegroups.com
All:

I created a LiveCycle/Acrobat/Reader project under Google Code.  I would like to encourage you to add small snippets of code demonstrating various aspects of form design and/or livecycle development.  

Everytime we get a code, example question, let’s have the code placed into this repository so others can use it as a knowledge source.

The URL is here:
http://code.google.com/p/livecycle-acrobat/

Command-Line Access
If you plan to make changes, use this command to check out the code as yourself using HTTPS:

# Project members authenticate over HTTPS to allow committing changes.
svn checkout https://livecycle-acrobat.googlecode.com/svn/trunk/ livecycle-acrobat --username Duane.Nickull

When prompted, enter your generated googlecode.com password.

Use this command to anonymously check out the latest project source code:

# Non-members may check out a read-only working copy anonymously over HTTP.
svn checkout http://livecycle-acrobat.googlecode.com/svn/trunk/ livecycle-acrobat-read-only

GUI and IDE Access

This project's Subversion repository may be accessed using many different client programs and plug-ins. See your client's documentation for more information.

Duane

Denise Lumley

unread,
Apr 2, 2008, 12:21:02 PM4/2/08
to live...@googlegroups.com

Great Idea!!!

 

Thanks so much,

dl

Carlos Nascimbene

unread,
Apr 2, 2008, 8:00:46 PM4/2/08
to live...@googlegroups.com
Excellent!!! We must start collaboration on this repository.

Regards,

Carlos

Jochem van Dieten

unread,
Apr 3, 2008, 3:24:09 AM4/3/08
to live...@googlegroups.com
On Wed, Apr 2, 2008 at 6:17 PM, Duane Nickull wrote:
> I created a LiveCycle/Acrobat/Reader project under Google Code. I would
> like to encourage you to add small snippets of code demonstrating various
> aspects of form design and/or livecycle development.

Good idea.


> Everytime we get a code, example question, let's have the code placed into
> this repository so others can use it as a knowledge source.

Maybe it is better to use one of the various code-share sites (like
http://codeshare.ulatu.com/) for *questions*, and the Google Code
repository for *solutions* that are *tested*.

Jochem

Chris

unread,
Apr 3, 2008, 12:55:34 PM4/3/08
to Adobe LiveCycle Developers
Duane,

I will be unable to post anything on Google Code until I'm added to
the developer list. My google account is `cso...@gmail.com`.
Reply all
Reply to author
Forward
0 new messages