reset form input after submission with jQuery

chris69m's Avatar


04 Mar, 2013 11:30 PM

hi guys,... can anyone help please,... I'm using jQuery,...
how can I reset form after submission with unique ID, this is what I have so far,... but it reset ONLY for last comment report. this form is for photo comment report,... and if I have lets say 9 comments, it only reset the last one "9" but not 1, or 2,... or 8

<?php echo $this->Form->create('PhotoComment', array('id'=>"ReportComments_".$photo_comment['PhotoComment']['id'])); ?>
    <?php echo $form->hidden('Report.sender_id', array('value' => $user_object['id'])) ?>

    <p style="font-size: 1.2em; font-weight: normal;">
<?php  echo $this->Form->textarea('Report.content'); ?>
<div class="clr"></div>
<?php echo $ajax->submit('Report', array('url'=> array('controller'=>'photo_comments', 'action'=>'report_spam/'. $photo_comment['PhotoComment']['id']), 'update' => "updateReportPhotoComment_".$photo_comment['PhotoComment']['id'], 'complete' => 'javascript:resetReportPhotoCommentForm();')); ?>
<?php echo $form->end(); ?>

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

function resetReportPhotoCommentForm()
document.getElementById("ReportComments_<?php echo $photo_comment['PhotoComment']['id'] ?>").reset();

thanks in advance

  1. 1 Posted by Nicole on 04 Mar, 2013 11:50 PM

    Nicole's Avatar

    Chris -

    You need to submit this to This is the support forum for Lighthouse proper.


  2. Nicole closed this discussion on 04 Mar, 2013 11:50 PM.

Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac