Skip to Content
0
Former Member
Oct 13, 2011 at 02:26 PM

Dropdown values in adobe form -ABAP binding and javascript issue

163 Views

Hi,

We have 2 dependent dropdown lists, dropdown A with values( 1,2,3) & dropdwon B with dependent values ( 1X,1Y,2X,2Y,2Z,3X,3Y). B values are dependent on A and it works perfectly fine when we fill first time ie NEW form .We have peice of javscript code which works fine which is placed in ON CHANGE of A, B Dropdown values are reflecting correctly.

Now when we want to change existing form we are bringing all vallues from ABAP backend from WDOINIT.

We are already binding old values..it is now showing previously selected values in dropdown A & B

but the problem in DROPDOWN B has now ALL values ( 1X,1Y,2X,2Y,2Z,3X,3Y). of dropdown A(it should only have selected values) for ex: if we select dropdown A with 1 it should show only 1X,1Y

In order to resolve this I wrote below code in INITIALIZE event of DROPDOWN A..Now it brings respective values of dropdown B but my previously selected value in drodown B is disappeared.In other words SCRIPT is over writing the ABAP Backend Binding of the dropdown B.

How can we over come this issue..I need both of them to work.. I need abap binding value (to retain previous value) and I need SCRIPT ( to store respective records ex: if we select dropdown A with 1 it should show only 1X,1Y )

termaction is Dropdown A , reason is dropdown B

	
		var termaction = this.rawValue;  
//above statement would brings current value of slected term action from 1st drodown
	

 				Reason.clearItems();
 				this.resolveNode("Reason").rawValue = null;
	var DataBinding = Reason.bind.ref;
	// the data binding may contain "$data.<root data name>" instead of $record
	DataBinding = DataBinding.replace("$data."+xfa.record.name,"$record");
	DataBinding = DataBinding.replace("$record.", "");
	DataBinding = DataBinding.replace("$.", "");
	hasItems = true;
	var reasonitemNode = 	xfa.form.resolveNode("xfa.datasets.data.HRDATA"+".sap-vhlist."+DataBinding.replace(/(\.)/g,"\\.").replace(/(\[\*\])/g,""));
	  			var reasonitemNodes = null;  
	  			if (reasonitemNode == null) {
					hasItems = false;
	  			}
	  			else try {
					reasonitemNodes = reasonitemNode.nodes;
	  			} catch(e) {
					hasItems = false;
	  			}

				console.println("Length:" + reasonitemNodes.length);
	  			if(hasItems == true) {
					
					var found = 0;
					var temptermaction;
					for (var i = 0; i < reasonitemNodes.length; i++) {
						
						temptermaction = reasonitemNodes.item(i).key.value;
						temptermaction = temptermaction.substring(0,2);
						temptermaction = temptermaction;
						
											
						if (termaction == temptermaction)
						{
							Reason.addItem(reasonitemNodes.item(i).text.value,reasonitemNodes.item(i).key.value);							
				
						}
						
					}
				
				}


		
//END

Rgds

Prasad

Edited by: Varaprasad kandagatla on Oct 13, 2011 4:27 PM

Edited by: Prasad on Oct 14, 2011 4:56 PM