CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Dependent Listbox On Edit Mode

Print topic Send  topic

Author Message
girish_327


Posts: 108
Posted: 08/28/2007, 6:52 AM

Hello All,
I am facing a very small problem on Dependent List box please try help me.

I have a dependent list box one Job_Type and second is Department when user in Insert Mode its working fine but when user goes to edit mode and click on directly to department listbox its showing all the values.

How can eliminate this thing?

I tried to set Javascript function to department "OnFocus" but this will refresh the list on first click in IE.

I used Below Javascript code :

onfocus="set_child_listbox(job_type, department, Product);"

  
  
  
function set_child_listbox(parentObject, childObject, childArray)   
{  
        //Clear child listbox  
        for(var i=childObject.length;i>0;i--)   
                {  
                childObject.options = null;  
                                  
        }   
        childObject.options[0] = new Option("Select Department","-1");  
        var sel_index = parentObject.options[parentObject.selectedIndex].value;  
  
        if (sel_index == "")   
        {  
                childObject.disabled = true;  
        }   
        else   
        {  
                childObject.disabled = false;  
                var childIndex = 1;  
                for (i =0; i < childArray.length; i++) {  
  
                    if (childArray[0] == sel_index) {  
                        childObject.options[childIndex] = new Option(childArray[2], childArray[1]);  
                        childIndex++;  
                    }  
                }  
        }  
        //Select first option  
                  
        childObject.selectedIndex = 0;          
}  
<!-- BEGIN Grid job_type -->var Product = new Array(  
      <!-- BEGIN Row -->new Array({parent_id},{job_type_id},"{job_type}")<!-- END Row -->  
<!-- BEGIN Separator -->, <!-- END Separator -->);     
<!-- END Grid job_type -->  
  
</script>  

_________________
Girish Baraskar
Web Designer/Developer
http://www.agnisdesigners.com
http://www.eindianpaintings.com
http://www.realestatekolhapur.com
View profile  Send private message
klwillis


Posts: 428
Posted: 09/02/2007, 8:31 PM

Sounds like you'll want to filter the Department listbox based on the Job_Type.
You can do this by setting the data-source type for the Department listbox to
Table and SQL and then use a parameter within the 'WHERE CLAUSE' which
references the value from the Job_Type listbox.

Then, use the 'OnChange' event for the Job_Type listbox which will resubmit the
form when the job type value changes - making sure you post back to the same
page so that you can see the new results in the Department Listbox.

If I'm not correct in identifying what it is you want to do, you'll need to be a bit
clearer so that others here can be of assistance.

Quote girish_327:
Hello All,
I am facing a very small problem on Dependent List box please try help me.

I have a dependent list box one Job_Type and second is Department when user in Insert Mode its working fine but when user goes to edit mode and click on directly to department listbox its showing all the values.

How can eliminate this thing?

I tried to set Javascript function to department "OnFocus" but this will refresh the list on first click in IE.

I used Below Javascript code :

onfocus="set_child_listbox(job_type, department, Product);"

  
  
  
function set_child_listbox(parentObject, childObject, childArray)   
{  
        //Clear child listbox  
        for(var i=childObject.length;i>0;i--)   
                {  
                childObject.options = null;  
                                  
        }   
        childObject.options[0] = new Option("Select Department","-1");  
        var sel_index = parentObject.options[parentObject.selectedIndex].value;  
  
        if (sel_index == "")   
        {  
                childObject.disabled = true;  
        }   
        else   
        {  
                childObject.disabled = false;  
                var childIndex = 1;  
                for (i =0; i < childArray.length; i++) {  
  
                    if (childArray[0] == sel_index) {  
                        childObject.options[childIndex] = new Option(childArray[2], childArray[1]);  
                        childIndex++;  
                    }  
                }  
        }  
        //Select first option  
                  
        childObject.selectedIndex = 0;          
}  
<!-- BEGIN Grid job_type -->var Product = new Array(  
      <!-- BEGIN Row -->new Array({parent_id},{job_type_id},"{job_type}")<!-- END Row -->  
<!-- BEGIN Separator -->, <!-- END Separator -->);     
<!-- END Grid job_type -->  
  
</script>  

_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
girish_327


Posts: 108
Posted: 09/02/2007, 10:00 PM

Hi,
Yes but I already did this scripting even its not require to resubmit page but when user come back to this page for updating the record that time the (if user click first department listbox) department listbox shows all the records which actually has to show only related records as per job_type listbox.

That I bug I want to remove.

Thanks
_________________
Girish Baraskar
Web Designer/Developer
http://www.agnisdesigners.com
http://www.eindianpaintings.com
http://www.realestatekolhapur.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.