Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Bind a numeric field to text field.

Avatar

Level 2

I want to have a numeric field that if it is >150 the drop down box will show one set of choices and if any < or = 150 another set of choices will be displayd. Can this be done?

5 Replies

Avatar

Level 7

on the "exit" event for your numeric field:

if (this.rawValue > 150) {

     rblSet1.presence = "visible";

     rblSet2.presence = "hidden";

}

else {

     rblSet1.presence = "hidden";

     rblSet2.presence = "visible";

}

Now, I don't know what "set of choices" you're using. In my example, I went with a radio button list. The code in the if/else clauses sets the entire list to visible or hidden so that it doesn't interfere with the layout when your user changes the number.

Avatar

Level 2

Hi

Thanks for you response, I will be using a drop down list, so if it is >150 it will populate the drop down box with a set list and if not it will be populated with another list.

Thanks again

Chris

Date: Mon, 23 Dec 2013 12:41:03 -0800

From: forums_noreply@adobe.com

To: chrisjoly16@hotmail.com

Subject: Bind a numeric field to text field.

Re: Bind a numeric field to text field.

created by jasotastic81 in LiveCycle Forms - View the full discussion

on the "exit" event for your numeric field:

if (this.rawValue > 150) {

rblSet1.presence = "visible";

rblSet2.presence = "hidden";

}

else {

rblSet1.presence = "hidden";

rblSet2.presence = "visible";

}

Now, I don't know what "set of choices" you're using. In my example, I went with a radio button list. The code in the if/else clauses sets the entire list to visible or hidden so that it doesn't interfere with the layout when your user changes the number.

Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5953470#5953470

Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:

To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.

Start a new discussion in LiveCycle Forms at Adobe Community

For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

Avatar

Level 7

I don't know where this list is coming from , so you might have to modify this code accordingly. If you know for certain what choices you'll use when adding the items, add this to your "exit" event for the numeric field:

if(this.rawValue > 150) {

     ddChoices.clearItems();

     ddChoices.addItem("Choice 1");

     ddChoices.addItem("Choice 2");

     ...

}

else {

     ddChoices.clearItems();

     ddChoices.addItem("Choice A");

     ddChoices.addItem("Choice B");

     ...

}

Avatar

Level 2

What I am trying to set up is a numerical field that will have a dollar amount entered, if the dollar amount is under $150 then the approval box ( drop down list) will populate with a list of

Names, if $150 and over, a different list of names will appear in the drop down list. I have the same thing set up with two text drop down lists.

Thanks for your help

Sent from my iPad

Avatar

Level 7

So, make sure the display pattern for the numeric field is set to look like currency, then the data that is entered (or calculated from some other fields) is going to fit the if statement.

Select the numeric field, object pallette > Field tab > Patterns...

-Under the display tab select the option for "$1234.21".

-Under the data tab, select the option for "num.decimal{}" or "num.currency{}". ("num.decimal{}" will prevent entering the "$" or whatever currency symbol is appropriate.)

Then, when the user enters an amount and clicks on the dropdown list (ddChoices in my example), the script checks the value and fills it in appropriately.