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) »
  • Modify Profile Form Fields "view_only" status based on context
Pages: [1]

Author Topic: Modify Profile Form Fields "view_only" status based on context  (Read 604 times)

kingmoore

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 3
  • CMS version: Drupal
  • MySQL version: 5
  • PHP version: 5
Modify Profile Form Fields "view_only" status based on context
January 13, 2011, 12:01:33 pm
On a profile form that shows up when registering an event, we would sometimes like the First Name & Last Name fields to be "view only" but other times to be updatable, based on if a variable is set.

We have spent a good deal of time trying to implement hook_civicrm_buildForm to do something like this:

//not exact code, going from memory here
mymodule_civicrm_buildForm($formName, &form) {
 
  $form->fields['first_name']['is_view'] = 1;
  $form->fields['last_name']['is_view'] = 1;

}

I can see that it is updating the form variables correctly, but it does not change the rendering of the form. I think this has to do with the $customtPre & $customPost variables and is simply not possible to do here.

So we moved on to try to do this in the block.tpl file, but it also does not seem possible to update the 'is_view' property in the tpl file and change the rendering of the form int he tpl file. Where in the code can we modify the form structure before the form is rendered for the Profile forms?

Thanks.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Modify Profile Form Fields "view_only" status based on context

This forum was archived on 2017-11-26.