ppresent,

Here's how I did it:

I have 2 comboboxes on my page:

cbLocations
cbSites


I wanted 'cbSites' to get refreshed whenever 'cbLocations' changed. So in
the extraHtml property of 'cbLocations' I put

onChange=refreshSites()

and I defined the javascript 'refreshSites' function in my html file(see
attached html file).

Also I created a button 'btnShowSites' on the page and this is its webevent:

        public int btnShowSites_onWebEvent(CSpWebEvent event)
        {
                int command = PROCEED;

                CSpComboBox theBox = (CSpComboBox)
getDisplayField("cbSites");
                
                theBox.removeAllChildren(true);

                theLocationID = getDisplayFieldValue("cbLocations");
                
                CSpSelect theDO = (CSpSelect)
CSpider.getDataObject("doSitePickList");
                
                theDO.clearDynamicCriteria();
                
        
theDO.addDynamicCriterion("MCSC2_LOCATIONS_ID",CSpCriteriaSQLObject.EQUAL_TO
_INT_OPERATOR, theLocationID);

                theDO.execute();
                
                if (theDO.getNumOfRows()< 1)    {
                        setDisplayFieldValue("stStatus", new CSpString("No
site exists for the selected location."));
                }
                else {
                        setDisplayFieldValue("stStatus", new CSpString(""));
                        theBox.doAutoFill();
                }
        
                load(false);

                return(command);
        }
        //]]SPIDER_EVENT<btnShowSites_onWebEvent> 


Since the button web event is called from the function and don't want it to
display on the page, I commented it out in the html file (see near the
bottom) 

Following part of the html file is all you need to look at:

<SCRIPT LANGUAGE=javascript>
<!--

        function refreshSites() {


                document.pgAddExternalLink.action
="../MCSC/pgAddExternalLink.btnShowSites_onWebEvent(btnShowSites)";
        document.pgAddExternalLink.submit();

        }
        
        
        
//-->
</SCRIPT>



<!-- **btnShowSites**  This is commented because it is called via
Javascript:  refreshSites() -->

Hope this helps.

-Nimmi



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 28, 1999 12:58 PM
To: [EMAIL PROTECTED]
Subject: [ND] Populating a second combo box based on the value selected
in the first combo box


Anyone out there know if it is possible to populate a second combo box based
on a value selected in the first
combo box without clicking any buttons.

Any suggestion on this will be greatly appreciated.

ppresent
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to