Oops !! forgot to attach the html file.


-----Original Message-----
From: Shamdasani Nimmi-ANS004 
Sent: Friday, May 28, 1999 1:50 PM
To: '[EMAIL PROTECTED]'; 'NetDynamics'
Subject: RE: [ND] Populating a second combo box based on the value
selected in the first combo box


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]

Title: pgAddExternalLink

[[SPIDERPAGE NAME=pgAddExternalLink]]
**MCSC2_LINKED_ELEMENTS_FK_SOURCE_NE**
**stPageHeading**
**stFieldMessage**
Source Element ID:**stSourceNEID**
Source Local Name:**stSourceLocalName**
Source Element Type:**stSourceElementType**
Select Location:**cbLocations**
Select Site:**cbSites**
*Destination Element:**MCSC2_LINKED_ELEMENTS_FK_DESTINATION_NE**
*Link Type:**MCSC2_LINKED_ELEMENTS_FK_LINK_TYPE**
*Relationship:**MCSC2_LINKED_ELEMENTS_RELATIONSHIP**

**Insert** **btnPrevScreen****stStatus** **SPIDERSESSION** [[/SPIDERPAGE]]

Reply via email to