• Publicity: Public Only All

data-procs.tcl

Datatype validation for the ArsDigita Templating System

Location:
packages/acs-templating/tcl/data-procs.tcl
Author:
Karl Goldstein <karlg@arsdigita.com>
CVS Identification:
$Id: data-procs.tcl,v 1.25 2024/09/11 06:15:48 gustafn Exp $

Procedures in this file

Detailed information

template::data::transform (public)

 template::data::transform type value_ref

Dispatch procedure for the transform method. "transformation" in template systemspeak means to convert the submitted data to the custom datatype structure, usually a list for complex datatypes, just the value for simple datatypes. The transform method is called after the datatype is validated.

Parameters:
type (required)
The data type to be transformed.
value_ref (required)

Testcases:
No testcase defined.

template::data::validate::boolean (public)

 template::data::validate::boolean value_ref message_ref

Validates boolean data types.

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:
Roberto Mello

Testcases:
validate_boolean

template::data::validate::date (public)

 template::data::validate::date value_ref message_ref

Validate that a submitted date conforms to the template system's notion of what a date should be.

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

Testcases:
validate_date

template::data::validate::email (public)

 template::data::validate::email value_ref message_ref

Validate that a submitted email address is syntactically correct.

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

Testcases:
validate_email

template::data::validate::enumeration (public)

 template::data::validate::enumeration value_ref message_ref

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

Testcases:
validate_enumeration

template::data::validate::filename (public)

 template::data::validate::filename value_ref message_ref

Validate that a submitted filename consists of alphanumeric, "_", or "-" characters.

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

Testcases:
validate_filename

template::data::validate::float (public)

 template::data::validate::float value_ref message_ref

Validate that a submitted fla contains only an optional sign, and a whole part and fractional part.

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

Testcases:
validate_float

template::data::validate::integer (public)

 template::data::validate::integer value_ref message_ref

Validate that a submitted integer contains only an optional sign and the digits 0-9.

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

Testcases:
validate_integer

template::data::validate::keyword (public)

 template::data::validate::keyword value_ref message_ref

Validate that a submitted keyword consists of alphnumeric or "_" characters.

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

Testcases:
validate_keyword

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

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

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 (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:
Rocael Hernandez

Testcases:
validate_naturalnum

template::data::validate::nomarkup (public)

 template::data::validate::nomarkup value_ref message_ref

Checks if supplied string contains markup.

Parameters:
value_ref (required)
message_ref (required)
Author:
Guenter Ernst

Testcases:
No testcase defined.

template::data::validate::number (public)

 template::data::validate::number value_ref message_ref

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

Testcases:
validate_number

template::data::validate::oneof (public)

 template::data::validate::oneof value_ref message_ref

Checks whether the submitted value is contained in the list of values provided via the "-options" parameter of "::template::element::create". If it is set an error is thrown.

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
See Also:

Testcases:
validate_oneof

template::data::validate::search (public)

 template::data::validate::search value_ref message_ref

It was necessary to declare a datatype of "search" in order for the transformation to be applied correctly. In reality, the transformation should be on the element, not on the datatype. DRB: in practice a template form datatype is defined by the presence of a validate procedure for that type.

Parameters:
value_ref (required)
Reference variable to the submitted value
message_ref (required)
Reference variable for returning an error message
Returns:
True (1)

Testcases:
validate_search

template::data::validate::string (public)

 template::data::validate::string value_ref message_ref

Validate that a submitted string is valid. Hmmm ... all submitted strings are valid, that's easy!

Parameters:
value_ref (required)
Reference variable to the submitted value
message_ref (required)
Reference variable for returning an error message
Returns:
True (1)

Testcases:
validate_text

template::data::validate::text (public)

 template::data::validate::text value_ref message_ref

Validate that submitted text is valid. Hmmm ... all submitted text is valid, that's easy!

Parameters:
value_ref (required)
Reference variable to the submitted value
message_ref (required)
Reference variable for returning an error message
Returns:
True (1)

Testcases:
validate_text

template::data::validate::textdate (public)

 template::data::validate::textdate value_ref message_ref

Validate that a submitted textdate if properly formatted.

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.

Testcases:
validate_textdate

template::data::validate::time_of_day (public)

 template::data::validate::time_of_day value_ref message_ref

Validate time of day.

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

Testcases:
validate_date

template::data::validate::timestamp (public)

 template::data::validate::timestamp value_ref message_ref

Validate that a submitted date conforms to the template system's notion of what a date should be.

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

Testcases:
validate_date

template::data::validate::url (public)

 template::data::validate::url value_ref message_ref

Validate that a submitted url is correct. Accepts an optional http:// or https:// prefix, path, and query string.

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

Testcases:
validate_url

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

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

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

Testcases:
validate_url_element
[ show source ]