template::data::validate::enumeration (public)
template::data::validate::enumeration value_ref message_ref
Defined in packages/acs-templating/tcl/data-procs.tcl
Validate enumeration as a unique csv alphanum list.
- Parameters:
- value_ref (required)
- Reference variable to the submitted value
- message_ref (required)
- Reference variable for returning an error message
- Returns:
- True (1) if valid, false (0) if not
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- validate_enumeration
Source code: upvar 2 $message_ref message $value_ref value # alphanumeric csv set result [regexp {^([A-z0-9]+,?)+$} $value] if { ! $result } { set message "[_ acs-templating.Invalid_enumeration] \"[ns_quotehtml $value]\"" return $result } # unique list set list [split $value ,] set result [expr {[llength $list] == [llength [lsort -unique $list]]}] if { ! $result } { set message "[_ acs-templating.Invalid_enumeration_duplicate_elements [list value [ns_quotehtml $value]]]" } return $resultXQL Not present: Generic, PostgreSQL, Oracle