Jump to content


Photo

ajax chained selects


  • Please log in to reply
2 replies to this topic

#1 feri_soft

feri_soft
  • Members
  • PipPipPip
  • Advanced Member
  • 147 posts

Posted 30 September 2006 - 08:02 AM

i have this xajax script for chaines selects:

<select id='select1' name='select1' onchange="xajax_chain(this.value)">
<option value="1">1</option>
<option value="2">2</option>
</select>
<?php
function chain($selectValue)
{
    $objResponse = new xajaxResponse();
    $objResponse->addAssign('select2','options.length',0);
   //get values of second select based on first here
    switch($selectValue)
    {
        case '1':
            $objResponse->addScript('addOption("select2","option11");');
            $objResponse->addScript('addOption("select2","option12");');
            break;
        case '2':
            $objResponse->addScript('addOption("select2","option21");');
            $objResponse->addScript('addOption("select2","option22");');
            break;
    }
    return $objResponse;
}
?>

i could not ake it working can you give me any suggestions?

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 02 October 2006 - 12:45 PM

Sorry, I don't have any experience with xajax... have you worked with any of their examples?

Info: PHP Manual


#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 10 October 2006 - 08:36 PM

The sample AJAX application in my sig shows chained selects
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users