tags:

views:

67

answers:

1
<script type='text/javascript'>
$(document).ready(function() {
 $("#specific_consultant_yes").click(function() {
$('.specific').show('slow');

$.post("<?php echo  $this->url(array('controller'=>'appointment', 'action' =>'available'),'default',true)?>",{app_date:$("#App_date").val(),consultant:$("#Consultants").val()} ,function(data){
$(".new").html(data);
});

 $("#App_date").change(function() {
$.post("<?php echo  $this->url(array('controller'=>'appointment', 'action' =>'available'),'default',true)?>",
                        {app_date:$("#App_date").val(),consultant:$("#Consultants").val()} ,function(data){
$(".new").html(data);
});
});

 $("#Consultants").change(function() {
$.post("<?php echo  $this->url(array('controller'=>'appointment', 'action' =>'available'),'default',true)?>",{app_date:$("#App_date").val(),consultant:$("#Consultants").val()} ,function(data){
$(".new").html(data);
});
});

});


 $("#specific_consultant_no").click(function() {
$('.specific').hide('slow');
});

});
</script>
  <form name='update_form' id='update_form' method='POST' action="<?php echo $this->url(array('controller' => 'appointment', 'action' =>'updatesave'));?>">

    <fieldset name='Appointment'>
                        <legend>New Appointment Details</legend>
                      <div class='field50Pct'>
                        <div class='fieldItemLabel'>
                        <label for=''>Specific Consultant</label>
                        </div>
                        <div class=fieldItemValue'>
                        <input type='radio' name='specific_consultant' id='specific_consultant_yes' value='yes'>Yes
                        <input type='radio' name='specific_consultant' id='specific_consultant_no' value='no'>No
                        </select>
                        </div>
                        </div>
                        <div class='clear'></div>
                        <div class='specific' style='display:none'>
                        <div class='field50Pct'>
                        <div class='fieldItemLabel'>
                        <label for=''>Appointment Date</label>
                        </div>
                        <div class=fieldItemValue'>
                        <select name='app_date' id='App_date'>
                        <?php
                        $today = time();
                        for($i = 0 ;$i < 15; $i++)
                        {
                        $date_t = date('d-M-Y',$today);
                        $date_v = date('d-m-Y',$today);
                        ?>
                        <option value="<?php echo $date_t ?>"><?php echo $date_t ?></option>
                        <?php
                        $today = $today+(1*24*60*60);
                        } ?>
                        </select>
                        </div>
                        </div>
                        <div class='field50Pct'>
                        <div class='fieldItemLabel'>
                        <label for=''>Consultant</label>
                        </div>
                        <div class=fieldItemValue'>
                          <select name='consultants' id='Consultants'>
                        <?php foreach($this->consultantlist as $consultantlist){ ?>
                        <option value="<?php echo $consultantlist->getId() ?>"><?php echo $consultantlist->getFirstName() ?>  <?php echo $consultantlist->getMiddleName() ?>  <?php echo $consultantlist->getLastName() ?></option>
    <?php } ?>
                        </select>
                        </div>
                        </div>

                        <div class='clear'></div>
                        <br/>
                        <div class='new'>

                        </div>
                        <div class='clear'></div>
                        <br/>
                        </div>
                        </fieldset>
                        <center><input type='submit' name='update_appointment' value='Update Appointment' onclick='return confirmSubmit();'></center>
                        </div>
                        </form>

and available.phtml has code like

<?php

                $afternoon_time = '11:00';
                $myresult  .=   "<input type='text' name='slotddd' value='hai'>";

echo $myresult;

?>

the extra form element is getting added properly and its getting displayed..but when i submit the form..the element si not recognized in the $_POST ...how to solve this problem>

A: 

Where is the 1 item with class "new" located? Is it inside the form? If its not located inside the form then it won't be included.

For example:

<form action="/post.php" method="POST">
  <input name="somename" value="somevalue"/>
</form>

Is not equal to:

<form action="/post.php" method="POST">
</form>
<input name="somename" value="somevalue"/>
thetaiko
i have a div like <div class='new'> </div>and i have jquery function like <script type='text/javascript'>$(document).ready(function() { $("#specific_consultant_yes").click(function() {$('.specific').show('slow');$.post("<?php echo $this->url(array('controller'=>'appointment', 'action' =>'available'),'default',true)?>",{app_date:$("#App_date").val(),consultant:$("#Consultants").val()} ,function(data){$(".new").html(data);});
pradeep
which will fill in the data from a page called available.phtml<?php$afternoon_time = '11:00';$myresult .= "<input type='text' name='slotddd' value='hai'>";echo $myresult;?> its loading the text field but not available in $_POST field
pradeep
@pradeep - is the `<input.../>` being added inside the `<form>...</form>`? On the submit page, at the very top put `echo print_r($_POST, true);`
thetaiko