Hello.
I would like a help to help me to think
I have a list of customers with their informations (telephone, address, e-mail, name...). It are about 120 customers.
So I put a Drop-down List where there are all the customers/names. When the user choose some name, it will change (on the same page, below object drop-list down) the information of the client selected (e-mail, address, phone, etc).
I got to do this using several tables with the same names of value selected on drop-list down. For example: If the user selects a name with the same name of a table, this table will have your presence changed to visible. It works perfect, but my form (in mode Design View) became slow very much (why there are many table within in a single subform).
Does anybody can say me if there is another way to do this using a simple way and lighter
NOTE: I am using table, because in each information, for example phone, I put a image/icon of telephone and also for that all the information stay in a single place.
Is there a example here.
Solved! Go to Solution.
Views
Replies
Total Likes
If you look at the ScriptObject, I have placed 4 different customers information.
While adding values to the dropdown, I am only using the Name value..
At run time, when the user chooses one of the customer name from the dropdown, then I need to pick up all the related information for the selected customer from the script object code. For this, I am looping thru all the cstomers in the Script object and comparing the name value to find out whose name was selected.
Once the code identifies whose name is selected, then the related information will be populated to the other fields.
Hope this helps..
Thanks
Srini
Views
Replies
Total Likes
It would be easier to place the names and other details of the people in the script object and display the respective values when you choose the dropdown value..
This way, you can only have one table all the time and replace values based on the dropdown selection..
Here is a sample in a similar way..Based on the Country selection, it changes the State dropdown values..Based on the State selection it changes the values in City dropdown..
https://acrobat.com/#d=CpmL3cuLdnNPeJ6Vc0IhdQ
Thanks
Srini
Hi Siri, how are you?
Thanks for your importante reply.
I saw your example but as I am begining, I didn't understand very well. But, basead in your example I had an idea. If I create several fieldtext and to use the condition to change values them?
For example:
if (drop-list.rawValue == Client_1){
name.rawValue = Client 1
address.rawValue = Address' Client 1
email.rawValue = email's Client 1
}
if (drop-list.rawValue == Client_2){
name.rawValue = Client 2
address.rawValue = Address' Client 2
email.rawValue = email's Client 2
}
..... and continue (how will be about 120 clients, else I will have 120 conditions ("if")
To show this information, I would put this fields in position correct on the table with event "calculate"
What do you think about this? My form would be lag?
Thanks!
Views
Replies
Total Likes
I would do it as Srini suggested.
Use an script object, this is much easier to handle that hundreds of if conditions.
In short:
You create a script object and add array for each data set you need (client, name, phone numbers etc.).
Each array needs the same number of records (120 clients, 120 names, 120 phone numbers etc.).
With a function you then can populate the table from those arrays.
var ClientList = new Array(
" ",
"AAA",
"BBB",
"CCC");
var NameList = new Array(
" ",
"A John",
"B Bob",
"C Jack");
var PhoneList = new Array(
" ",
"A 0123",
"B 0456",
"C 0789");
var MailList = new Array(
" ",
"A John@company.org",
"B Bob@company.org",
"C Jack@company.org");
var AddressList = new Array(
" ",
"A Street 123",
"B Alley 4",
"C Road 2a");
//Function to populate the fropdown list with the client names
//This is called from the enter:Event of the dropdown list
function PopulateClients(dropdownField)
{
for (var i=0; i < ClientList.length; i++)
dropdownField.addItem(ClientList[i]);
}
//Function to populate the table depending on the selected client
//This is called from the change:Event of the dropdown list
function PopulateData(Client, Name, Phone, Mail, Address)
{
for (var i=0; i < ClientList.length; i++)
{
if (ClientList[i] == Client) //Get instance number of selected client from the client array
{
Name.rawValue = NameList[i]; //Return name from the names array with the same instance number
Phone.rawValue = PhoneList[i]; //Return phone number from the phones array with the same instance number
Mail.rawValue = MailList[i]; //dito
Address.rawValue = AddressList[i]; //dito
break;
}
}
}
Those functions is triggered from your drop down list.
Data.PopulateData(xfa.event.newText, Table1.Row1.Name, Table1.Row2.Phone, Table1.Row3.Mail, Table1.Row4.Address);
Here an example:
Hello.
How are you radzmar?
Sorry, but I think your example is bug because it doesn't open here.
Can you share it again?
I will study your script, because how I am new user in this plataform (javascript X FormCalc) I am lost yet.
Sorry for me
Views
Replies
Total Likes
Hi
I have also a doubt: for your script works very well, I have to put informations in order (same position) within array, correct?
Views
Replies
Total Likes
Hi radzmar.
Could you answer my question above, please.
Thanks.
Views
Replies
Total Likes
Here is a sample I made for you..
https://acrobat.com/#d=RINmaXW3bG*gEYcS-CAeYg
The sample Radzmar provided requires the related elements to be placed at the same index in each of the array.
You can use any of the approach to work on your issue..
Thanks
Srini
Views
Replies
Total Likes
Hi Sirini, How are you?
First of all, I would like to thank you for youi attetion in to do this great sample.
I understood perfect what this script pretend to do, but i have a question in this part:
for
(customer in Data.customers)
{
if (Data.customers[customer].name == xfa.event.newText)
{
Address1.rawValue
=Data.customers[customer].address1;
Address2.rawValue
=Data.customers[customer].address2;
City.rawValue
=Data.customers[customer].city;
State.rawValue
=Data.customers[customer].state;
Zipcode.rawValue
=Data.customers[customer].zipcode;
}
}
The "customer" is variable? And why did you use the codition "for"?
Thanks so much
Views
Replies
Total Likes
I have used "for loop" to go through the entire list of customers information and findout which one is matching to the option selected in DropDown.
Yes, "customer" is a variable in for loop.. You can use any name there.. It is like a for each loop we use in any language..
For example:
for (x in Data.customers) {
if (Data.customers[x].name == xfa.event.newText){
Adress1.rawValue =Data.customers[x].address1;
Address2.rawValue =Data.customers[x].address2;
City.rawValue =Data.customers[x].city;
State.rawValue =Data.customers[x].state;
Zipcode.rawValue =Data.customers[x].zipcode;
}
}
Thanks
Srini
Views
Replies
Total Likes
Hi.
Srini, thanks for you reply.
So at the value of variable customer receive the value from the DropList than do the comparation? that is I don´t understand.
Sorry so much question. Your script works very well, but I am curiosity then I would like to learn how it works
Views
Replies
Total Likes
If you look at the ScriptObject, I have placed 4 different customers information.
While adding values to the dropdown, I am only using the Name value..
At run time, when the user chooses one of the customer name from the dropdown, then I need to pick up all the related information for the selected customer from the script object code. For this, I am looping thru all the cstomers in the Script object and comparing the name value to find out whose name was selected.
Once the code identifies whose name is selected, then the related information will be populated to the other fields.
Hope this helps..
Thanks
Srini
Views
Replies
Total Likes
Hi Srini.
How are you:
Sorry for my delay to reply your post.
So, now I undertood a litle. As I am new user on the LiveCycle, I still have difficult, but with your comments I got to understand better.
NOTE: I am already ordered the Book about LiveCycle (Construing form with Adobe LiveCycle)
Thanks so much radzmar too!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies