ComboBox and JavaScript

Posted by: d-thoma on 10 September 2017, 11:27 am EST

  • Posted 10 September 2017, 11:27 am EST

    <P mce_keep="true">Somewhat new to JavaScript, hopefully this is simple.</P>
    <P mce_keep="true">Ultimately what I am after is after the item is selected in a ComboBox we run an "Query" back to the server and return data to the page and fill in some text boxs (well some componentone maskedits in this case).</P>
    <P mce_keep="true">I have narrowed it down to the "OnClientBlur" and "OnClientTextChanged" functions, but I have no idea on how to access the value the "ComboBox1" value/text/selectedindex.</P>
    <P mce_keep="true"> The only thing I have been able to figure out is if I do:</P>
    <P>document.getElementById("ct100_ContentPlaceHolder1_TextBox1").value = "xyz";</P>
    <P mce_keep="true"> I can fill in a text box with "xyz".</P>
    <P mce_keep="true">I just need the "how" to get the information out of the combobox1 ...then I will work on the ajax part of the script. </P>
    <P mce_keep="true">Can anyone give me a good place to start learning javascript as well?</P>
    <P mce_keep="true"> Thank you for your help.</P>
  • Replied 10 September 2017, 11:27 am EST

    <p>Hi Thoma, </p>

    <p> </p>

    <p>Thank you for using C1ComboBox. Could you please look at the sample code I provided to see if this sovled your problem. </p>


    <script type="text/javascript" id="ComponentOneClientScript1"><br> function c1ComboBox_OnClientSelectedIndexChanged(sender, arg) {<br> var selectedItem = sender.get_selectedItem();<br> var index = selectedItem.get_index();<br> var text = selectedItem.get_text();<br> var value = selectedItem.get_value();<br> }<br></script></pre> P.S.:</pre>For learning javascript, I think you could go to this site to see if there is something you need.</pre> </pre>For ajax, you could have a look at Manning,</pre> </pre> </pre>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels