Thursday, October 25, 2012

Re: ajax submit and reset form after submission

Thanks Chetan,.... !! it works,.... 


On Thursday, October 25, 2012 1:13:20 AM UTC-7, chetan varshney wrote:
You can call javascript function on complete


<?php echo $ajax->submit('Add', array('url'=> array('controller'=>'photo_
comments', 'action'=>'ajax_add/'. $photo['Photo']['id'] ), 'update' => 'updateDiv', 'complete' => 'javascript:resetThisForm();')); ?>
 
<script>
function resetThisForm()
{
document.getElementById("FormId").reset();
}
</script>

On Thu, Oct 25, 2012 at 1:15 PM, Chris <chri...@yahoo.com> wrote:
hi guys,... is there a way to reset form after ajax submission...? or do I have to go thru jquery submission? 
here is my form: 

<?php echo $this->Form->create('PhotoComment'); ?> 
    <?php echo $form->hidden('user_id', array('value' => $user_object['id'])) ?>
<?php  echo $this->Form->textarea('content', array('rows' => '3')); ?>

<?php echo $ajax->submit('Add', array('url'=> array('controller'=>'photo_comments', 'action'=>'ajax_add/'. $photo['Photo']['id'] ), 'update' => 'updateDiv')); ?> 

     <div class="clr"></div>

<div id="updateDiv" style="margin: 10px 0 10px 0;"></div> 

thanks in advance 
chris 


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 



--
Chetan Varshney
Ektanjali Softwares Pvt Ltd

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: