template::data::validate::url_element (public)

 template::data::validate::url_element value_ref message_ref

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

Beautiful URL elements that may only contain lowercase characters, numbers and hyphens.

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
Author:
Tilmann Singer
See Also:
  • util_text_to_url if you want to offer auto-generation of URLs based on a pretty name

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

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

    set expr {^[a-z0-9-]+$}
    set result [regexp $expr $value]

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

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