Showing a field based on an option in a drop-down list
I'm trying this out and I think have finally given up the figure. Hope someone can help you completely. Here's what I want to do:
I have a dropdown menu with option 3; QUARTER, HALF, FULL. Based on what a person chooses, I want the next field to modify the price accordingly. If, for example, if they choose a QUARTER, I want the price to appear $2 in the field below, she, if HALF the price appears $4 and so COMPLETE that the price will be displayed $6.
I know it's probably just a matter of writing, YEW script somewhere but I don't know where and I don't know how.
Hoping for a useful answer
Go to the form view edit and then click on other tasks - change fields - Set
Field calculation order...
Tags: Acrobat
Similar Questions
-
How to use Javascript to populate a text field based on a selection in a drop-down list?
Greetings,
I have virtually no experience with JavaScript and I'm trying to find a way to add some functionality to basic Automation to a form of Adobe. I have a drop down box called "Hospital_Name" which will contain about 7 possible selections. When the user makes a selection, I would like to have the field of text (called "Hospital_Address") under the drop-down list fill with the corresponding address to the selection. I have the "Hospital_Address" text field set up for multiple lines and want the address to have a line break between the address and the city/province/postal code.
For example, if the user has selected "Hospital 1", the text field would display:
123 main St
Anytown, CA 12345
Help or you can provide examples would be greatly appreciated.
'Re missing you the document level script that sets the data object and setItems function.
document level JavaScript; Could be placed in the action open to the page if you cannot access the document JavaScripts level;
Place all the pre-population data into a single data structure
var Location = {}
' - Hospital - ': {line1: "', line2:" "" "},
'Bellevue Medical Center': {line1: "2500 BMC Drive", line2: "Bellevue, NOT 68123"},"CHI Bergan Mercy": {line1: "7500 mercy Road", line2: "Omaha, NOT 68124"},
'CHI Emmanuel': {line1: "6901 N 72nd Street", line2: "Omaha, NOT 68122"},
'CHI Lakeside': {line1: "16901 Lakeside Hills Court", line2: "Omaha, NOT 68130"},'CHI Midlands': {line1: "11111 s. 84th Street", line2: "Papillion, DON'T 68046"},
'Creighton University Medical Center': {line1: ' 601 n. 30th Street ', line2: "Omaha, NO 68131"},
'Nebraska Medical Center': {line1: "4400 Emile Drive", line2: "Omaha, NOT 68105"}
};function SetFieldValues (Hospital_Name) {}
location [Hospital_Name] .line1 = this.getField("AddLine1").value;
this.getField("AddLine2").value = location [Hospital_Name] .line2;
}end document level scripts;
custom script hits;
If {(event.willCommit)
If (event.value == "") this.resetForm (["AddLine1", "AddLine2"]); of other SetFieldValues (event.value);
}
end of custom keystroke script;
Note the formatting of the elements in a column as a line we can help revise the code. Also use a text editor for processing code.
-
Change the border color of text field based on a value from the drop-down list
I have a dropdown menu with 4 choices of priority for maintenance. With a javascript script, I need to be able to select a 'priority' in a list box and a text box border then color with an appropriate color.
'High priority' with an export value of 0
"Medium priority" with a value of exports of 1
'Low priority' of an export value of 2
"When the time allowed" with a value of exports of 3
When one of these selections has been filed, a text box becomes available in order to write the gap. My goal is as follows.
When "High priority" is selected, the border of the text box where you write the gap would blush.
When "Moderately urgent" is checked, the border around the text box where you write the gap would turn yellow.
When "Low Priority" is checked, the border of the text box where you write the gap would become green.
When "when she allows" is checked, the border around the text box where you write the gap would have turned blue.
Otherwise, the border would be white.
This form will be used ultimately on an iPad using Expert PDF under the player. I use Acrobat X to create the form.
Any help would be appreciated.
Yes, I accidentally left a hug. I can fix it so it won't be a problem if someone tries to use it. Happy that you guessed it work.
To handle resetting, you can use a script to validate drop-down list:
Script to Validate drop-down list
If (event.value = "" "") {}
getField("discrepancy_1").strokeColor = color.white;
}
-
Defining form fields such as required based on the entry in the drop-down list
I'm trying to set the properties of a few form fields as required in the case of a specific value is selected from a drop-down list.
I entered the code of the tab actions from the drop-down list properties below > mouse down > run a java script. The problem is that it works only if I come out and enter again the drop-down list. "I tried to invoke the code with"Mouse down","Mouse entry", out of the mouse ' none of them worked unless I go out and again the drop-down list.
Any suggestions?
Thank you!
var devused is this.getField ("device");.
var comptype is this.getField ("Type of complaint");.
var proname = this.getField ("product name");
var feels = this.getField ("sent to the sponsor");
If (comptype.value == 'Associated Product complaint') {}
devused. Required = true;
proname. Required = true;
smells. Required = true;
}
else {}
devused. Required = false;
proname. Required = false;
smells. Required = false;
}
What you describe is the way documented in what forms Acrobat and Acrobat JS behave by Form Event Processing
For your described form, we can use a custom format for the field drop-down list script:
If (event.willCommit! = true & event.changeEx! = "")
{
var devused = this.getField ("device");
var proname = this.getField ("product name");
Envoy of var = this.getField ("sent to the sponsor");
Switch (Event.changeEx)
{
case "related product": complaint
devused. Required = true;
proname. Required = true;
smells. Required = true;
break; Go at the end of the switch;
Repeat fdor each value of the option in the drop-down list.
by default:
If no match for the above cases, it is found;
devused. Required = false;
proname. Required = false;
smells. Required = false;
break;
} / / end of switch event.changeEx;
} / / end not true willCommit;You must set the ' Commit selected value immediately "and as one moves upwards or downwards the options, the related fields will change and stay together when you exit the field note that the field name is not used in the script because the field is the event object until it leaves the field.
-
Command to refresh a calculated field when you select an option from the drop-down list box
When my form user selects an option in a drop-down list box, the value in the field (in this case, Total) I would like to update, but it isn't.
A radio button option box makes the Total-development field to automatic update when the user clicks on the radio button. But the drop-down list box is not updated Total (without clicking away from the field). I would like to add a command in the Combo Box to refresh the Total field when you selected the option to drop-down list box.
Someone at - it a code (Javascript?) to get there.
Thank you very much.
You don't need a script, simply select the 'Value selected to validate immediately' checkbox on the Options tab of the dialog list box drop-down list box field properties.
-
Make the field visible if 'Other' selected in the drop-down list
Is it possible to do a field visible and required if a selection is made in a menu drop-down.
For example, I have 4 different options in my drop down list, including the 'other' and if other is selected, I want a new text field is visible, so that the user can add more specific information.
Any help or advice would be appreciated.
If you use ColdFusion requiredattribute, I don't know how to change this dynamic. But if you do validtion aside client with javascript - or double check it after you submit with ColdFusion, it is easy in principle.
function checkifother()
{
myselectfield = document.getElementById('myselect');
explanationdiv = document.getElementById('explanationdiv');
if ( myselectfield.value == 'Other')
{explanationdiv.style.display='block'}
else
{explanationdiv.style.display='none'}
}
-
dynamically load the Options in a drop-down list in C++
Hey guys,.
I'm trying to dynamically load items Option in a drop-down list by using C++. I have a function in my class of WorkManager file that does the trick:
QStringList WorkManager::getListOfItems() { int i = 0; QStringList taskNames; // used for debugging mainly, so i can print the list out to debug QList
myObjects = m_model->toListOfObjects(); DropDown * dpList = bb::cascades::Application::instance()->scene()->findChild ("scriptListDropDown"); if (dpList != 0 ) { dpList->setSelectedOption(0); dpList->removeAll(); for (i = 0; i < myObjects.size(); i++) { Task * myTask = (Task *) myObjects[i]; taskNames.append(myTask->taskName()); dpList->add(Option::create().text(myTask->taskName()).value(myTask->command())); // delete myTask; // do I need to delete the task object? } // qDebug() << "WorkManager::getLIstOfItems(), ---> list of tasks is : " << taskNames; return taskNames; } else { qDebug() << "WorkManager::getListOfItems(), ---> dpList was 0"; return taskNames; // empty list } } I also found this thread:http://supportforums.blackberry.com/t5/Native-Development/Adding-options-to-a-DropDown-from-c/m-p/21... that helped me get the filled drop-down list when the application starts.
However, I need to re - fill list from time to time, when the list (a GroupDataModel) changes. calling the function above a second time anywhere in my application appears to hang the application immediately.
I think / thought it might have something to do with the slot for the onSelectedValueChanged, but I can't understand it.
It seems down right when I do dpList-> removeAll().
I also can't seem to find the right place to call this function to an object of type in my class. I think it's because the drop-down list is not ready yet as the dpList * is always 0 unless what I call after the line:
app->setScene(root);
in the applicationui.cpp file. Calling it works on start-up, but trying to update the list later (by removeAll() and recreate) causes the app crashing.
is there a better way to do it? .. and make it safer? I can't understand how to do this.
Thank you!
J
First, drop the:
dpList->setSelectedOption(0);
Not only if it is not necessary, but it will explode your application if the function is called when there is already no options in the menu dropdown.
Also, do NOT delete the task, because it is still owned by the datamodel. I also see that you use type casting C, which just blindly accepts your cast, even if it's a mistake. Instead, if you know for sure what kind it will be this way instead:
Task* myTask = static_cast
(myObjects[i]); If you are not sure if the type you are casting the is the type you need, use the dynamic_cast instead:
Task* myTask = dynamic_cast
(myObjects[i]); The advantage of this more static_cast , is that if you try to perform a type cast is not compatible, then myTask will be set to NULL.
Alternatively, Qt offers a replacement for dynamic_cast which works on platforms where is not regular C++ casts.
Task* myTask = qobject_cast
(myObjects[i]); It is functionally equivalent to dynamic_cast, but as I said, it works on all platforms that Qt exists, whereas dynamic_cast cannot.
Once you did get back to us.
oddboy wrote:
Hey guys,.
I'm trying to dynamically load items Option in a drop-down list by using C++. I have a function in my class of WorkManager file that does the trick:
QStringList WorkManager::getListOfItems() { int i = 0; QStringList taskNames; // used for debugging mainly, so i can print the list out to debug QList
myObjects = m_model->toListOfObjects(); DropDown * dpList = bb::cascades::Application::instance()->scene()->findChild ("scriptListDropDown"); if (dpList != 0 ) { dpList->setSelectedOption(0); dpList->removeAll(); for (i = 0; i < myObjects.size(); i++) { Task * myTask = (Task *) myObjects[i]; taskNames.append(myTask->taskName()); dpList->add(Option::create().text(myTask->taskName()).value(myTask->command())); // delete myTask; // do I need to delete the task object? } // qDebug() << "WorkManager::getLIstOfItems(), ---> list of tasks is : " << taskNames; return taskNames; } else { qDebug() << "WorkManager::getListOfItems(), ---> dpList was 0"; return taskNames; // empty list } } I also found this thread:http://supportforums.blackberry.com/t5/Native-Development/Adding-options-to-a-DropDown-from-c/m-p/21... that helped me get the filled drop-down list when the application starts.
However, I need to re - fill list from time to time, when the list (a GroupDataModel) changes. calling the function above a second time anywhere in my application appears to hang the application immediately.
I think / thought it might have something to do with the slot for the onSelectedValueChanged, but I can't understand it.
It seems down right when I do dpList-> removeAll().
I also can't seem to find the right place to call this function to an object of type in my class. I think it's because the drop-down list is not ready yet as the dpList * is always 0 unless what I call after the line:
app->setScene(root);
in the applicationui.cpp file. Calling it works on start-up, but trying to update the list later (by removeAll() and recreate) causes the app crashing.
is there a better way to do it? .. and make it safer? I can't understand how to do this.
Thank you!
J
-
Well I hope I can explain this well enough.
I have a drop down list that has two different options to choose from. For example:
Dropdown1 has: Option has
Option B
On the other page, I have two text fields. TextField1 shows just what is levied on the Dropdown1 (Option A or Option B). TextField2 must do the following: If Option A is taken I just need the field to remain a Virgin. If Option B is taken out I need to fill a specific text.
I thought that I found a way to do it, but it seems that since it's on another page the script will not pull.
Any help is very appreciated!
Hello
You can download Acrobat.com and then publish the form. Once you have published, you can copy the link and share it here.
In my example, I used the name of the first object "TextField1" for example. If your first object is named differently, you will have to modify the script accordingly.
There is an example on how to reference objects here: http://assure.ly/kUP02y.
Niall
-
By selecting an option in a drop-down list displays a hidden text box and checkbox
Being fairly new to the creation of pdf form I would be grateful for some assistance.
I'm looking to have a number of choices in a drop-down list (dropdown1) show a hidden textbox (textbox1) and the box (checkbox1)
The selections that would show are:
iPad only
Or
Laptop and iPad
I'm sure it's rather easy.
Thanks in advance
You can use this code as the custom for the drop-down list field validation script:
var f1 = this.getField("textbox1"); var f2 = this.getField("checkbox1"); if (event.value=="iPad Only" || event.value=="Laptop and iPad") { f1.display = display.visible; f2.display = display.visible; } else { f1.display = display.hidden; f2.display = display.hidden; }
-
Creation of calculation based on the result of the drop-down list
Hello. I hope that someone will be kind enough to help me with some Javascript because it seems that I am too blonde and middle ages to figure out by myself.
I have a drop-down list box 'Member '. The Yes value is 0. The value is 10.
Then I have three check boxes. "Day 1" value is 35. "Day2" value is 25. 'Dinner' value is 65.
If this option is enabled, I want the sum of the check boxes, if they are checked. (for example, total if all checked = 125)
If no is selected, the value of each check box rose 10. (for example, total if all checked = 155)
I use Acrobat X.
Thanks in advance.
Due to the fact that you want to add a constant number of values if a given condition is met then you will need to use a custom calculation script.
get the value of the fields
var cMember = Number (this.getField("Member").value);
var nDay1 = this.getField("Day1").value;
var nDay2 = this.getField("Day2").value;
var nDinner = this.getField("Dinner").value;
define a varaiable for the sum
var sum = 0;
day 1 more SETTINGS
If (nDay1! = "Off") the sum += (nDay1) Number + cMember;
day 2 more SETTINGS
If (Day2! = "Off") the sum += (nDay2) Number + cMember;
more dinner SETTINGS
If (nDinner! = "Off") the sum += (nDinner) Number + cMember;
Event.Value = sum;
Excel is easy if you would see Microsoft calculations.
-
Drop-down lists of the fill of the text fields on a different page from the drop-down list.
Hi all
I have a form with multiple pages. The first page contains a number of drop-down lists. These lists, drop-down list when the option is chosen, must complete a field text on another page. I can get the drop down menu to populate the text field when it is on the same page, but as soon as I move the text field to another page, the script does not work. Can anyone offer a solution? I used javascript on the changes to the scripts.
Every time reference you the other object... so I guess in the code located on the DDlist.
Paul
-
fill a list based on a value from the drop-down list box
Well, I know a way around it but its quite long with what I know. I worked on a better solution for a day now. So maybe (or likely) someone knows better. I'm trying to fill a drop drop down based on a user selection figure in a list of check boxes. I know I could create several drop-down lists and hide away them until the user changes the value of binding. But the dropdowns would consume a lot of space in my form design in liveCycle. So is there another way or I'm stuck he made a long journey. I also need to assign values to these elements, since they change because the values are used as item numbers later that fill a text/number field later in form as a list of materials.
Tell me if I'm wrong, please (I'm new to all this)
in the box in the click event
If (this.) RawValue == 1)
{
dropDownList1.addItem ("item # 1", "value1111");
dropDownList1.addItem ("item # 2", "value2222");
}
on the other
{
dropDownList1.rawValue = "null";
}
I'm sure that null is not good and I don't know that I have to set the drop-down menu to clear items on preOpen. Or maybe not. And there is a way to add items without the addition of a new right of the line? I'm on the right track?
Hello
Rather than having the script in each of the boxes, you can have the script in the event preOpen the drop-down list that leans on the boxes.
I downloaded an example here: https://acrobat.com/#d=VwREjsMgvqXpVqPu54kSNw
Take a look at the preOpen the dropdown event.
// clear the dropdown displayed value and items this.rawValue = null; this.clearItems(); // repopulate the items based on the checkboxes if(fruit.rawValue == 1) { this.addItem("Apples", "fruit_001"); this.addItem("Pears", "fruit_002"); this.addItem("Oranges", "fruit_003"); this.addItem("Bananas", "fruit_004"); this.addItem("Grapes", "fruit_005"); } if(cars.rawValue == 1) { this.addItem("Volvo", "car_001"); this.addItem("Ford", "car_002"); this.addItem("Opel", "car_003"); this.addItem("Toyota", "car_004"); this.addItem("Nissan", "car_005"); } if(counties.rawValue == 1) { this.addItem("Co. Tipperary", "county_001"); this.addItem("Co. Cork", "county_002"); this.addItem("Co. Dublin", "county_003"); this.addItem("Co. Clare", "county_004"); this.addItem("Co. Kerry", "county_005"); }
Hope that helps,
Niall
-
How to dynamically add an Option in the drop-down list?
I have this code:
{Drop-down list
ID: list
Title: 'list '.
onCreationCompleted: {}
opion var = new Option();
opion. Text = "Hello";
opion. Value = 4;List.Add (opion);
}
}
After the launch of the application, the list is empty.
Why my code does not work?
It is easy to dynamically add options
first add this to your attachedObjects:
ComponentDefinition { id: optionDefinition Option { } }
then do something like this
var newOption = optionDefinition.createObject() newOption.text = ... newOption.value = ... newOption.description = ... newOption.selected = .... yourDropDown.add(newOption)
-
Add options from a drop-down list of c ++
In my C++ files, I have a QMap to data that I want to add a drop-down menu that I have in QML.
I can't find examples of how to add options to a menu already existing but. Here's what I have in my file QML right now:
DropDown { id: account title : "Account" enabled : true }
It seems it should be a fairly easy process to get the id of the drop-down list and enter the data of my inside QMap.
Any help with this would be greatly appreciated!
Oh, I didn't see that you do not know how to connect the logic of C++ to the UI QML, the ID of the component QML is not enough, you must set objectName: property 'dropDown' too.
You can reach any CPP QML object like this:
This excerpt comes from YourProjectName.cpp
create the active document of the main.qml scene
Set parent document created to ensure that there is overall
application lifetimeQmlDocument * qml = QmlDocument::create("asset:///main.qml").parent(this);
Create the root for the UI object
AbstractPane * root = qml->() createRootObject;
game created the root like a scene object
App-> setScene (root);and here's the findChild method
Drop-down list * dpList = root-> findChild ("combo"); After this line, dpList will point to the controller of the user interface.
-
I use Firefox 4.0 and don't see a bookmark option Manager when I use the bookmarks drop down. How can I access it? I want to transfer my favorites on a new computer and want to use the export/import feature.
It's called show all bookmarks in 4.o + Firefox versions.
Maybe you are looking for
-
Updated yesterday, I tried to pull the first site in my combo and it wouldn't go. I tried to hit enter, and it wouldn't go. Finally press the address button reach, and he went. Very annoying.
-
Safari address bar does not work
Hello This morning I try to type the text in the address bar of safari, but I can't type, when I press on enter overlaps with the previous text. How to restore safari? Thank you Software version: OS X El Capitan 10.11.3
-
Unable to print after the capture and filing error OneNote should run once.
When you try to print after capture and deposit, it indicates that Onenote should run only once. Is this something that I now have to buy that worked before? OT: Snipping Tool
-
Keyboard is not showing is not the correct characters on Windows 8.1
Hi all, I have the model of keyboards two HP 5188-6077 and on Windows 8.1 capitalized 2 which should be the @ key is entered the "symbol and vice versa the" key gives the symbol @. I have never used these before on Win 8 keyboards, and they both do t
-
I got a new Acer laptop with Windows 7 64 bit I want to install an older HP Deskjet 3420 printer but cannot find a driver What should I do