This project is not covered by Drupal’s security advisory policy.

The module can prevent form elements of the types "select", "checkboxes" and "radios" from disclosing their option keys in the html source. This can be very useful if the values are email addresses or other sensitive data.

Inspired by a discussion on the webform issue queue,
Multiple Options, Same Value in 'Select' Form Element (+ Protect from Spam Harvesters)

Return value of the form elements will remain unchanged.

How to use

How to define a choice widget with hidden option keys:

$form['fieldname'] = array(
  '#type' => 'select',
  '#privatechoice' => TRUE,
  '#options' => array('aa_secret' => 'AA', 'bb_secret' => 'BB'),
  ... // all the other stuff you want to set for the select element.

Your html code will show

  <option value="0">AA</option>
  <option value="1">BB</option>

But the form element will return the original keys on submission.

Are there no other ways?

It is not that hard to write your own logic in the form creation callback and the submit handler, that does the same thing as the privatechoice module.

However, if you want a quick solution for an already existing form, privatechoice can make this a lot easier - without having to patch big parts of the form logic.

And, why bloat the form logic, if you can have the same almost for free?

Project Information

  • Maintenance status: Unknown
  • Development status: Unknown
  • Reported installs: 5 sites currently report using this module. View usage statistics.
  • Downloads: 901
  • Last modified: 27 November 2014
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.