Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Super Contributor
Posts: 18
Registered: ‎06-16-2009

How to call drop down list selected index event from java script?

Hi

 

I have a requirement where i need to update the stages dropdown which is in the salesprocess form(in fact set the selected index to desired value) on the click event of the link button that i have placed in task pane of the opportunity.

 

1)I have created a new form called form1 from new form wizard under opportunity and

i have choosen target work place as Task pane and Show in mode is detail.

 

2)I have placed a link button(button1)on  the form and on the click event of this button i am calling a java script for changing the value in the stages drop down of salesprocess tab(Prior to this i do have created a salesprocess callled process 1 from architect and i do have four stages called stage1,stage2,stage2,stage4 and i mapped the created process as default one to all the opportunites from the user options in web client). The below is the code and java script function what i using in the button(button1) click event of  form1

 

Button 1 Click Action Code Starts Here

 

ScriptManager.RegisterClientScriptBlock((Page)HttpContext.Current.Handler, HttpContext.Current.Handler.GetType(), "MyScript3",

"setComboValue('stage1');", true);

this.PanelRefresh.RefreshAll();

 

Java Script Function Starts Here************(The below script is for searching the stage1 value in the stages drop down list as it is appended with some other values like order number and probability)

 

 

function setComboValue(strid)

{

try

{

var list= document.all.ctl00_TabControl_element_OpportunitySalesProcess_element_view_OpportunitySalesProcess_OpportunitySalesProcess_ddlStages;

The above variable stores the id of the stage drop down  control which is in salesprocess tab for (var i=0; i<list.options.length; i++)

{

var current=list.options[i].innerText;  var strCount=current.search(strid); // alert(strCount); if(strCount != -1)

{

list.selectedIndex = strCount;

break;

}

}

return;

}

catch(e)

{

alert('error' + e.description);

}

}

Java script function Ends Here *********

 

3. The issue i am facing is i am able to set the value for the stages drop down control(in the sales process form)

 by using above code but the select index change event is not  getting called automatically and if i click the button1 again  the select index

changed event is getting fired on the sales process form.

 

4. How can I Make the selected index change(which is in saleprocess form) event of the stage drop down 

  fired from the other form(form1)as both are .ascx files

 

So Can any body kindly help me in this issue.

 

 

 

   Thanks in advance