Jump to content

Archived

This topic is now archived and is closed to further replies.

feri_soft

ajax chained selects

Recommended Posts

i have this xajax script for chaines selects:

[code]<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;
}
?>[/code]

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

Share this post


Link to post
Share on other sites
Sorry, I don't have any experience with xajax... have you worked with any of their examples?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.