template::data::validate::category (public)

 template::data::validate::category value_ref message_ref

Defined in packages/categories/tcl/widget-procs.tcl

Validates the value of a category widget.

Parameters:
value_ref (required)
message_ref (required)
Author:
Timo Hentschel <timo@timohentschel.de>

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.
Source code:

    upvar 2 $message_ref message $value_ref values
    set invalid_values [list]

    foreach value $values {
        if {![regexp {^[+-]?\d+$} $value]} {
            lappend invalid_values $value
        }
    }

    set result 1
    if {[llength $invalid_values] > 0} {
        set result 0
        if {[llength $invalid_values] == 1} {
            set message "Invalid category [lindex $invalid_values 0]"
        } else {
            set message "Invalid categories [join $invalid_values ""]"
        }
    }

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