I have a form that when a user selects something from a drop-down, another element in the form appears. There is another piece of the form, that is never showing up, I need to understand what I am doing wrong and how to fix it:
<script type="text/javascript" language="JavaScript"> function getAdjForm() { var params = Form.serialize($('createAdjForm')); alert($('territory').value); if ($('adjType').value !== "" && $('territory').value !== ""){ new Ajax.Updater( "adjForm", "<?= $this->url(array('controller'=>'index', 'action'=>'get-adj- form'))?>", {method:'post', parameters: params}); } } function getTerritories() { var params = Form.serialize($('createAdjForm')); new Ajax.Updater( "territories", "<?= $this->url(array('controller'=>'index', 'action'=>'get- territories'))?>", {method:'post', parameters: params}); if ($('adjType').value !== ""){ //alert('ddddddddd'); getAdjForm(); } } function getCustomer() { var params = Form.serialize($('createAdjForm')); new Ajax.Updater( "customer", "<?= $this->url(array('controller'=>'index', 'action'=>'get- customer'))?>", {method:'post', parameters: params}); } </script> <form method="POST" id="createAdjForm" action=""> <p> <table border="0" CELLSPACING="10"> <tr> <td> <b>Select Adjustment Type</b> </td> <td> <?php echo $this->formSelect('adjType', $this->adjType, array ("onChange"=>"getAdjForm()"), array(""=>"Select an Adjustment Type") + $this->adjTypes) ?> </td> </tr> <tr> <td> <b>Submitting Territory</b> </td> <td> <?php echo $this->formSelect('shortTerritory', $this- >shortTerritory, array("onChange"=>"getTerritories()"), array (""=>"Select a Territory") + $this->shortTerritories) ?> <div id="territories"></div> </td> </tr> <tr> <td valign="top"> <b>Justification</b> </td> <td> <?php echo $this->formTextarea('justification',$this- >justification,array("rows"=>"5","cols"=>"75")) ?> </td> </tr> </table> <hr> <div id="adjForm"> </div> *********************************** This issue is that the data that should be here: <div id="adjForm"> </div> Is never showing. When getAdjForm(); is called from getTerritories(), the $('territory').value !== "" seems to be the problem. Does the browser not know that was an element because it just appeared? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---