Re: Dynamic dropdown lists (select)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After reading the rest of the conversation, I think the best solution is the
next thing:
First, if I got this correct, you can extract the makes select-element from
the mysql using a query? if so, then extract it and host is in a temp
variable.
The next thing is writing down a js code, that contains an array of models
for each make. Personally, I'd use a 2 dimension array, the first dimension
for the make id/name and the second for the model id/name.
The 2 dimm. array you write with something like


> echo '<script type="text/javascript">var whatever = new Array();';
> foreach ($cars as $idx => $car)
>        echo 'whatever['.$idx.'] = "'.$car->getName().'";';
> echo '</script>';


as Zoltan said.
Then you have just simplefied it to a JS based script, i think this is the
best way you will figure out which does NOT contains AJAX, only static JS ;)

HTH,
Nitsan

On 04/04/2008, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:
>
> On Fri, Apr 4, 2008 at 1:11 PM, Daniel Brown <parasane@xxxxxxxxx> wrote:
>
> > On Fri, Apr 4, 2008 at 9:33 AM, Ryan Yagatich <ryagatich@xxxxxxxxxx>
> > wrote:
> > > Angelo Zanetti wrote:
> > >  > Hi all,
> > >  >
> > >  > I am looking at options for creating a dynamic dropdown list.
> > >  <snip>
> > >
> > >
> > >  > Is there any other idea or thing I can do? Im thinking maybe AJAX
> but
> > this
> > >  > is for a mobile site (WAP/xHTML) site and Im not sure if the
> > functionality
> > >  > will work on these devices.
> > >  >
> > >  >
> > >  You're pretty limited to the use of JavaScript here, and even more
> > >  limited to what you can do with it. For instance, JS works on the
> Treo
> > >  700p just fine - but when you get to making HTTP requests through JS
> > >  (AJAX and related talk goes here) - they refuse to execute. (The 700p
> > >  uses Blazer 4.5 web browser):
> > >  http://en.wikipedia.org/wiki/Blazer_(web_browser)<
> http://en.wikipedia.org/wiki/Blazer_%28web_browser%29>
> >
> >     For posterity's sake (and an FYI), I'll point out that Internet
> > Exploder on the Treo 700wx does have a JavaScript parsing engine, but
> > does *not* handle AJAX very well at all.
> >
> >    I know this comes as a big surprise that a Microsoft product is
> > lacking when compared to another.
>
>
> im not a fan of this technique on full-blown web browsers, but in this
> case
> it sounds like a workaround is called for.  you could just handle the
> onchange event on the the select element and submit the form to the server
> for a full page refresh.
> eg.
>
> <form id="ddlForm" method="post" action="">
> <select onchange="document.getElementById('ddlForm').submit()">
> <!-- options -->
> </select>
> </form>
>
> you may also consider embedding the form in an iframe to enhance
> performance, tho im no expert on the mobile front :D
>
> -nathan
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux