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) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Disable Select Options Widget on Webform
Pages: [1]

Author Topic: Disable Select Options Widget on Webform  (Read 823 times)

luchtcm

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.38-MariaDB
  • PHP version: 5.4.30
Disable Select Options Widget on Webform
July 03, 2014, 05:25:46 pm
Hi all,

I've got two forms that I'm creating and need some help on one particular little item.

Form #1 establishes contacts to the person filling out the form. Once the form is complete, an email is sent to each contact.

The second form displays the name of the person that filled out Form #1. This information, though, is "disabled" so that it's not editable. I'd also like to display the relationship to person that filled out Form #1. The best that I can see to do this is to create a static select options widget with only the relationship types established in Form #1. This does display the relationship information just fine.

The ask, however, is if there's a way to make this "disabled" as well. It doesn't appear as though there's a way to make the selection drop-down box "disabled" like you can for text fields.

I've tried changing the select options widget to something like a text field, hoping that'd display the information and be "disabled", however, the relationship data doesn't display in that format.

Any thoughts? I'll attach a screenshot of the select options widget that I'd like to disable.

Thanks!

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Disable Select Options Widget on Webform
July 04, 2014, 05:46:17 am
Webform might not support disabled select fields, but html does, and iirc so does Drupal FAPI, so you could write a quick little hook_form_alter to set the field to "disabled" or "readonly".
Try asking your question on the new CiviCRM help site.

luchtcm

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
  • CiviCRM version: 4.4.3
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.38-MariaDB
  • PHP version: 5.4.30
Re: Disable Select Options Widget on Webform
July 05, 2014, 04:48:58 pm
Thanks for the tip. I was able to do just that. I'm no developer, but was able to figure out how to do it with a simple little hook_form_alter with enough googling, a demo, and trial-and-errors.


For reference, here's the line that performs the disable.


Code: [Select]
$form['submitted']['civicrm_2_contact_1_fieldset_fieldset']['civicrm_2_contact_1_relationship_relationship_type_id']['#disabled'] = TRUE;


Thanks!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Disable Select Options Widget on Webform

This forum was archived on 2017-11-26.