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
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?
- Maintenance status: Unknown
- Development status: Unknown
- Reported installs: 8 sites currently report using this module. View usage statistics.
- Downloads: 329
- Last modified: November 27, 2014