Closed (fixed)
Project:
Webform
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
7 Nov 2006 at 02:52 UTC
Updated:
14 May 2007 at 20:35 UTC
If to use letters only the national alphabet (Russian, for example) in component options with identical quantity of blanks identical names will be generated.
Example:
- select component
- options:
Проба раз
Проба два
Проба три
- result in select field: only one item - "Проба три"
Solution: Rewrite _webform_safe_name function.
was:
function _webform_safe_name($name) {
$new = drupal_strtolower(trim($name));
$new = str_replace(' ', '_', $new);
$new = preg_replace('/[^a-z0-9_]/', '', $new);
// If the string contains NO safe characters, base64 encode the answer
if ($new == '') {
$new = base64_encode($name);
}
return $new;
}
became:
function _webform_safe_name($name) {
$new = drupal_strtolower(trim($name));
$new = str_replace(' ', '_', $new);
$new = preg_replace('/[^a-z0-9_]/', '', $new);
return $new.'_'.base64_encode($name);
}
or just:
function _webform_safe_name($name) {
return base64_encode($name);
}
Comments
Comment #1
quicksketchRather than further encrypt select values, I added the ability to manually enter key/value pairs. So keys may now be entered my_safe_key|Some crazy value.
Comment #2
dries commented