CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Adding a reset button to a profile form
Pages: [1]

Author Topic: Adding a reset button to a profile form  (Read 4002 times)

dwebster

  • Guest
Adding a reset button to a profile form
May 07, 2008, 01:12:50 pm
Hi,
I'm trying to figure out how to add a button (to reload the page or reset the form) next to the submit button on one of my profile forms.  Any suggestions?

Thanks,

Dan

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Adding a reset button to a profile form
May 08, 2008, 04:38:37 am
You should be able to do this by creating a custom copy of a profile template as discussed here:

http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in+and+Profile+Screens

... and then adding <INPUT type="reset"> to the .tpl file in the desired spot ?
Protect your investment in CiviCRM by  becoming a Member!

webstercoder

  • Guest
Re: Adding a reset button to a profile form
May 09, 2008, 03:20:26 am
Perfect.  Thanks Dave! :)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Adding a reset button to a profile form
October 30, 2008, 07:41:22 pm
Hey this method adds a "RESET" button to the form but that reset button only works to clear the form before the form is submitted and the search goes to ?_qf_Search_display=true... in the URL line.  After the search is performed the reset button no longer functions to clear the form.

Any thoughts on why and how to fix?

FYI, still using CiviCRM 2.0.x
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Adding a reset button to a profile form
October 31, 2008, 09:51:03 am
Reset button "resets" form values to what they were when page was loaded - so if the fields have values, they are reset TO those values. There are stock javascripts you can find online which empty all fields - so you could check around for one of those and try adding it to your form.
Protect your investment in CiviCRM by  becoming a Member!

ds505

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 3
Re: Adding a reset button to a profile form
April 01, 2009, 11:37:33 pm
I found another way around this to add a link on the resulting Listings Page that reloads the Search Page (instead of just clicking the back button which saves the search criteria and doesn't result in a new search). I've done this on CiviCRM 2.0.

1.  Find the Search.tpl file (templates/CRM/Profile/Form/Search.tpl). Make a copy of it and place it in your template override directory.

2.  At the top of the file, hard code the path to the desired Profile search page and remove the javascript action.

Example:

   
Code: [Select]
<div id="id_{$groupId}_show" class="section-hidden section-hidden-border">
       <a href="http://www.yourwebsite.org/civicrm/profile?reset=1&gid=#">{ts}New Search{/ts}</a><br />
    </div>

Thanks,
LJ
« Last Edit: April 10, 2009, 11:40:00 am by ds505 »
Data-Scribe(r)
http://www.datascribe.biz

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Adding a reset button to a profile form

This forum was archived on 2017-11-26.