Link to home
Start Free TrialLog in
Avatar of Nelson3000
Nelson3000Flag for United States of America

asked on

In HTML, how do I trigger a Postback after a ComboBox value is updated?

Please Help!!!

I have a page with a ComboBox.
I want to trigger a Postback when the ComboBox is updated.

Am I on the right track with the following code?

----------------------------------

 <Script> 
function ComboChange(obj) {
var comboValue = document.getElementById('MktReportSelectDate').value;
__doPostBack('MktReportSelectDate', comboValue);}
</Script> 


<TR>
   <TD  ALIGN="RIGHT">Reporting Period:&nbsp;&nbsp;</TD>
   <TD  ALIGN="LEFT"><SELECT NAME="MktReportSelectDate" ID="MktReportSelectDate" OnChange="ComboChange()" >
<OPTION VALUE="Custom Date Period" SELECTED>Custom Date Period
<OPTION VALUE="First Quarter">First Quarter
<OPTION VALUE="Second Quarter">Second Quarter
<OPTION VALUE="Third Quarter">Third Quarter
<OPTION VALUE="Fourth Quarter">Fourth Quarter
<OPTION VALUE="This Year">This Year
<OPTION VALUE="Last Year">Last Year
<OPTION VALUE="This Month">This Month
<OPTION VALUE="Last Month">Last Month
</SELECT>
</TD>

</TR>

Open in new window

----------------------------------

The ComboBox is displayed properly. But the Postback is not triggered when a new value is selected.

I am new to HTML and have a project that I need to complete ASAP. Any help would be greatly appreciated.

Many Thanks,

Nelson
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What is the error in your console? Check  the __doPostBack function  scope .
Avatar of Nelson3000

ASKER

Thanks very much ste5an.  Your solution worked perfectly.

Your assessment of what I was trying to accomplish was spot-on and your redesigned function was exactly what I needed.

For future reference,  I will make sure to follow your recommendation about how to properly include code fragments in my questions.

Thanks again for the excellent solution and the HTML lesson.