Excellet Kristinn! Thanks! /alex
On 2/19/07, Kristinn Sigmundsson <[EMAIL PROTECTED]> wrote: > Heres a similar example from when I was starting out with jquery, had > ALOT of "test" pages back then :P > Might help you > > Javascript: > var formOptions = { > male: 'test5.php?type=male', > female: 'test5.php?type=female', > unknown: 'test5.php?type=unknown' > }; > > $("#extraLoader").change( function () { > if (formOptions[this.value]) { > $("#extrafields").load(formOptions[this.value]); > } > }); > HTML: > <select id="extraLoader" name="extraLoader"> > <optgroup label="select your gender"> > <option value="female" /> Female > <option value="male" /> Male > <option value="unknown" /> No idea > </optgroup> > </select> > <div id="extrafields"></div> > > PHP (test5.php): > <? > if (isset($_GET['type'])) > { > switch ($_GET['type']) > { > case "male": > ?> <label for="desc">male</label><input type="text" name="desc" > id="desc"/> > <? break; > > case "female": > ?> <label for="desc">female</label><input type="text" > name="desc" id="desc"/> > <? break; > > case "unknown": > ?> <label for="desc">unknown</label><input type="text" > name="desc" id="desc"/> > <? break; > } > } > ?> > > // Kristinn > <div id="extrafields"></div> > On 2/19/07, Alex Ezell <[EMAIL PROTECTED]> wrote: > > Thanks Ben! > > > > I am working on implementing this now. I will post again, once I have > > it. Perhaps my blunders can help you to know what not to do :) > > > > /alex > > > > On 2/17/07, Benjamin Sterling <[EMAIL PROTECTED]> wrote: > > > Alex, > > > I would do something like: > > > > > > var optionstoform = { > > > roadtrip : 'roadtripform.htm', > > > vanpool : 'vanpoolform.htm' > > > }; > > > > > > and on the select menu put a vanpool, roadtrip as the value of the options > > > and bind a change event to it, which i think you have already, and do a > > > $.load or $.ajax call that looks something like. > > > > > > $.ajax example > > > > > > $.ajax({ > > > dataType: 'html', > > > url: optionstoform.roadtrip, > > > success:function(){ > > > // events to add the new form element to old > > > } > > > }); > > > > > > This is all just off the top of my head, but this is the approach I am > > > taking on a current project that needs to pull in an number of different > > > elements at a time. > > > > > > Hope this points you in the right direction. > > > > > > -- > > > Benjamin Sterling > > > http://www.KenzoMedia.com > > > http://www.KenzoHosting.com > > > _______________________________________________ > > > jQuery mailing list > > > discuss@jquery.com > > > http://jquery.com/discuss/ > > > > > > > > > > _______________________________________________ > > jQuery mailing list > > discuss@jquery.com > > http://jquery.com/discuss/ > > > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/