NYCPHP Meetup

NYPHP.org

[nycphp-talk] Need ideas on implementing this feature

Carlos A Hoyos cahoyos at us.ibm.com
Wed Sep 4 12:40:34 EDT 2002


When I first saw the chainedselectors class that builds two drop downs,
with the second one repopulating based on the first choice, I was trilled.

http://www.zend.com/zend/tut/drop-down.php

Later, I found a couple of things that could be definitively improved in
the javascript (the blank spaces at the end, and all the code is not very
effective).
One of my side projects (whenever corporate life gives me a break), is to
rewrite this class.

Check it out and see if that's what you need... maybe this will give me the
incentive :)







                                                                                                                                       
                      Peter Simard                                                                                                     
                      <peter at panvox.net        To:       NYPHP Talk <talk at nyphp.org>                                                   
                      >                        cc:                                                                                     
                                               Subject:  [nycphp-talk] Need ideas on implementing this feature                          
                      09/04/2002 11:02                                                                                                 
                      AM                                                                                                               
                      Please respond to                                                                                                
                      talk                                                                                                             
                                                                                                                                       
                                                                                                                                       



Here's the scenario:

In selecting an ingredient to include in a recipe the user makes the
choice, then chooses the unit of measure ( Hamburger 3 ounce ), however,
some ingredients have a custom conversion unit available to them which is
a user defined unit of measure,  and other ingredients don't.

Problem:  When loading the select boxes with ingredients, the user has
yet to choose an ingredient, so determining if an ingredient has a custom
conversion associated with it is unknown.

My thought here is to write/load a JavaScript array with the all the
custom conversions and their associated ingredients.  When an ingredient
is selected a function determines if that ingredient has a custom
conversion associated with it, if yes, then the unit of measures
available to that ingredient in the next select box are updated to
reflect the fact that the selected ingredient has custom conversion
munits to choose from in addition to the standard measurements.

So mixing the JS and the PHP, is this a sound method, or would one
recommend doing it all server-side?  If the recommendation is server-side
I envision lots of page updates in the process.

FYI: I know my client will have JavaScript enabled.

Any thoughts?

Thanks, Pete











More information about the talk mailing list