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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • how to set and show a custom message on return
Pages: [1]

Author Topic: how to set and show a custom message on return  (Read 1519 times)

saffrongeek

  • Guest
how to set and show a custom message on return
September 17, 2009, 09:53:13 pm
Hi ,

      I am newbie to civicrm, and just started using it to learn it. I was able to get a small custom module hbm.module and in it I wrote a small logic within a function hbm_civicrm_pre(). So whenever  the contact is added this hook gets invoked.

     What I am trying to do is, like email validation failure messages that appear top of contact form , I wanted to show a custom message. I am not able to make out how this is done in civicrm.

     I tried some stuffs like, drupal_set_message(ts()) , returning a $error array etc .. but none of it appears in the contact form.

     How can I just prepare a custom message and return the contact page back to edit form from the pre() invoke.

     Thanks in advance for the pointer and help..

With regards,

saffrongeek

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: how to set and show a custom message on return
September 17, 2009, 10:21:53 pm

You can validate form, using the hook_civicrm_validate

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmvalidate

there is an example of how to pass errors back to the form for good display :)

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

saffrongeek

  • Guest
Re: how to set and show a custom message on return
September 19, 2009, 11:33:50 am
Hi lobo,

           Thanks for the pointer link.. :) this helps, :)

Thanks

saffrongeek

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • how to set and show a custom message on return

This forum was archived on 2017-11-26.