template::data::validate::naturalnum (public)

 template::data::validate::naturalnum value_ref message_ref

Defined in packages/acs-templating/tcl/data-procs.tcl

Validates natural numbers data types. Will trim leading 0 in order to avoid Tcl interpreting it as octal (code borrowed from ad_page_contract_filter_proc_naturalnum)

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not
Author:
Rocael Hernandez

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_naturalnum validate_naturalnum (test acs-templating) template::data::validate::naturalnum template::data::validate::naturalnum test_validate_naturalnum->template::data::validate::naturalnum _ _ (public) template::data::validate::naturalnum->_

Testcases:
validate_naturalnum
Source code:
    upvar 2 $message_ref message $value_ref value

    set result [regexp {^(0*)(([1-9][0-9]*|0))$} $value match zeros value]

    if { ! $result } {
        set message "[_ acs-templating.Invalid_natural_number] \"[ns_quotehtml $value]\""
    }

    return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: