cancel
Showing results for 
Search instead for 
Did you mean: 

Drop down list values based on another Drop down list

Former Member
0 Kudos

Hello,

I have an interactive adobe form, where 3 drop down lists are made.

Dynamic binding is working very fine... I have issues in validations.

Its totally offline form. Data is downloaded in form while downloading from SAP system itself.

Drop Down lists are : Sold to, Ship-to and Contact-to.

Dynamically data is uploaded in these fields while downloading from the CRM database.

Now in offline scenarion, when the user selects 1 Sold-to, only corresponding shipto and contact to should be visible in other 2 drop boxes, By Default all values for sold to , ship to and contact to are shown.

I have made the complete interface using SFP and not webdynpro, however internal table is passed in Interactive Form.

Soldto Shipto

1 1a

1 1b

2 2a

2 2b

2 2c

Any input for validations or data bindings are welcome.

Please suggest

Thanks & Regards,

Narendra.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Narenda,

have the script on the exit event of the drop down.as in script below


 form1.AAA.VisibleDDS.Country::exit - (JavaScript, client)

var country = this.rawValue;
this.parent.State.clearItems();
this.parent.State.rawValue = null;
if(country != null){
	var StateSize = form1.AAA.HiddenDDS.State.length;
//	xfa.host.messageBox("val ="+StateSize );
	for(var i =0;i<StateSize;i++){
//	xfa.host.messageBox("val ="+form1.AAA.HiddenDDS.State.getSaveItem(i).substring(0,4));
		if(form1.AAA.HiddenDDS.State.getSaveItem(i).substring(0,5) == country)
			this.parent.State.addItem(form1.AAA.HiddenDDS.State.items.nodes.item(i).value,form1.AAA.HiddenDDS.State.getSaveItem(i));
	}
}

also replied your mail with the attachment.

Cheers,

Sai

Former Member
0 Kudos

Dear Krishna Sir

I am developing an adobe interactive form using web services method first i created a function module covert it to RFC .after that i created a web service in soa manager . when i drag all the fields of function module in the form .then i change one text field object to drop down list object with some value. when i press the submit button all the data filled in the form updated in database except the value selected by the drop down list.

I bind the value statically in the form in object palettes. when i click on the drop down list of the form a java script form is open in the top. please tell me whether i have write some java script code here. i can't bind it by default binding . please suggest answer.

Answers (3)

Answers (3)

Former Member
0 Kudos

I got the solution by using java script and appending the soldto parties before the shipto party string.

Thanks All for all valuable inputs.

ChrisSolomon
Active Contributor
0 Kudos

There are a few "tricky" ways you can handle this. Years ago, I had to do something similar for a auto dealership. Cars are similar......make, model, year......depending on the make, only certain models are available...and then for those models, only certain years may be possible.

For you form, you "could" load all your data into HIDDEN drop-down boxes (not the first one). Then you can do a small "trick" as I said....

so for instance, if you FIRST box has key/text piars like....

0001 - First Soldto

0002 - SecondSoldto

0003 - thirdSoldto

you can have your "hidden" drop down for shipto have their own "key" but then a "text" that is a combo of the actual text + the corresponding "primary" match. So you might have....

45322 - this ship to/0001

46790- another ship to/0001

55334- yet another one/0002

76888 - only on shipto/0003

soooo....when the user picks from the first box....say they pick "First Soldto"....0001. You then have Javascript "read" the values from your "hidden" drop down.....using a delimitter like "/", using string functions to find the location of your delimitter, take all characters after that, match them to the select "primary" (0001 for us) and THEN add the "key" plus text into your VISIBLE dropdown. So for us, we picked 0001 in the first drop-down, from the hidden one, we find the matching values so, our VISIBLE dropdown should have....

45322 - this ship to

46790- another ship to

Make sense? Of course, if we could do true scripting within the form, we could pull those values in without the need for the "hidden" drop-down trick and just create our dropdowns on the fly.

Make sure you have script in as well so that when the user selects a new value in the first drop-down, it "blows aways" the values in your VISIBLE dropdowns so they can't pick mismatched values.

Hope this helps.

Former Member
0 Kudos

Hello Chris & Sanoosh,

I got your inputs to reach to the solution. However I have applied though, but I guess I am missing some step in code in triggering right event.

I am clear with solution what needs to be implemeted, but am not getting the right way of writing that scripts.

Can any1 of you give me the downloaded adobe forms from their system if anyone has made?

I checked the adobe inbuilt examples, but all are of static values only and not dynamic values from database.

Thanks & Regards,

Narendra.

Former Member
0 Kudos

Hi Narendra,

Try the script in the exit event of first dropdown.

Thanks & Regards,

Sanoosh

Former Member
0 Kudos

Hi,

If you have a set of records in a table or array, you can use the following javascript fn.

Loop the table, get the value and add item to the dropdown using,

DropDownList1.addItem("First Item");

Thanks & Regards,

Sanoosh

Former Member
0 Kudos

Hi Sanoosh,

Thanks for reply.

Binding is done dynamically as :

for shipto => $record.SHIP_TO_PARTY.DATA[*].NAME

for soldto => $record.SOLD_TO_PARTY.DATA[*].NAME

As per your suggestion, so should i remove the dynamic binding for shipto and contactto fields and handle the filling of drop down boxes manually?

Also Can you please tell me how to loop in table using javascript as per sold to party selected. I tried google, I am not getting any good forum for the same.

Thanks for reply.

Regards,

Narendra.

Former Member
0 Kudos

Hi Narendra,

I think you will have to remove the binding first and populate the values using javascript.

Use following script to loop table, get the values and add to dropdown list.

var hidTab = xfa.resolveNodes("mainForm.subForm.table[*].DATA[*]");
var hidTab_len = hidTab.length;
for (var i=0; i<hidTab_len; i++)
{
     var text  = hidTab.item(i).Field1.rawValue;
     var value = hidTab.item(i).Field2.rawValue;
     DropDownList1.addItem("text","value");
}

Thanks & Regards,

Sanoosh