template::data::validate::number (public)
template::data::validate::number value_ref message_ref
Defined in packages/acs-templating/tcl/data-procs.tcl
Validate number - any float - should be any rational number?
- 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_number
Source code: upvar 2 $message_ref message $value_ref value # Not allowing for scientific notation. Would the databases swallow it? set result [regexp {^([+-]?)(?=\d|\.\d)\d*(\.\d*)?$} $value] if { ! $result } { set message "[_ acs-templating.Invalid_number] \"[ns_quotehtml $value]\"" } return $resultXQL Not present: Generic, PostgreSQL, Oracle