p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

beginning_php thread: SV: Should I do this server side or client-side

Message #1 by Rodolphe Toots <Rudde@I...> on Wed, 4 Sep 2002 17:03:33 +0200
go for the javascript approach!
or else the user has wait for a page to everytime he/she selects an
and of course, you will get a lots of request roundtrips to the 
and database server
i have used this a lot..the javascript way will be a lot more 

-----Ursprungligt meddelande-----
Fr=E5n: peter@p... [mailto:peter@p...]
Skickat: den 4 september 2002 16:00
Till: beginning php
=C4mne: [beginning_php] Should I do this server side or client-side

In selecting an ingredient to include in a recipe the user makes the
choice, then chooses the unit of measure ( Hamburger 3 ounce ), 
some ingredients have a custom conversion unit available to them which 
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 
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 
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 
I envision lots of page updates in the process.

FYI: I know my client will have JavaScript enabled.

Any thoughts?

Thanks, Pete

  Return to Index