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) »
  • Add a preview/confirmation step on a form
Pages: [1]

Author Topic: Add a preview/confirmation step on a form  (Read 3356 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Add a preview/confirmation step on a form
March 23, 2008, 01:55:18 pm
Hi,


I would like to add a preview in one form, as inspired by this doc:
http://civicrm.org/node/98 and the existing code

on the buildQuickForm, I built the 'first step' form,

I would like to then check a few things and display a confirmation/preview before saving for real.

What's the best way of doing that (I've tried to use the wizard, but I'm lost), beside it seems quite a big stuff for simply asking for confirmation before doing the save.

on the postProcess, I can do that, but I don't know how to recall the template, nor doing anything.

I feel I'm not using the tools the right way, and missing something obvious.

Any suggestion more that welcome (look at file XYZ as example is a brilliant answer as well)

X+




-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Add a preview/confirmation step on a form
March 23, 2008, 06:39:35 pm

you have a couple of options:

1. Use a javascript confirm (you can add the needed js code in the 'attributes' argument for quickform)

2. Use a two step wizard (similar to contribution / import / any of search tasks) to implement this. As you've noted, this is a bit more work, but we dont do this too often, and hence not really optimized in the architecture

3. You can try to do something similar to what we do in some of the mailing forms.

templates/CRM/Mailing/Page/Resubscribe.tpl, CRM/Mailing/Page/Resubscribe.php

Note that these forms are quite simple and we do not use the QF framework for them :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Add a preview/confirmation step on a form
March 24, 2008, 12:00:07 am
Thanks,

I would like to try the wizard way, but I'm stuck with the code. It seems I have to declare a controler ? How do I associate it with the page/form ? How do I define the various steps and tpl associated with it ?

I didn't find docs about it, am I missing something ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Add a preview/confirmation step on a form
March 24, 2008, 12:04:09 am

no docs for now, but check the following files:

CRM/Import/Controller.php
CRM/Import/StateMachine.php
CRM/Import/Form/*.php

This should give you a decent idea of how things link together. Chat with us on IRC if u need any help / clarification

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Add a preview/confirmation step on a form
April 06, 2008, 06:55:47 am
Hi,

Following Lobo's help on IRC, I've been able to have something working. Then I touched the wrong thing at the wrong time and the templates aren't used anymore ;(

Is there a debug mode that describes in detail what's going on in the civicrm libs, so it can know what is the wrong thing I touched ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Add a preview/confirmation step on a form
April 06, 2008, 11:39:11 am

check your settings in global settings and ensure that the custom template path is set. thats the one that is sent over to smarty in the template path setting

Ensure that the custom templates are readable by the web server :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Add a preview/confirmation step on a form

This forum was archived on 2017-11-26.