Custom Server-Side Validator Element

Home | Getting Started | API | Elements | Actions | Validators | Handlers | Configuration Options | Plugins | Mobile | Troubleshooting | About

Table of Contents

1 Custom Server-Side Validator - #custom {}

Attach a custom validator, written in Erlang, to an element. The validator will be executed on the server during a postback.


% Function to validate that a value is either upper or lower case,
% depending on the value of Tag...
F = fun(Tag, Value) ->
  case Tag of
    upper -> string:to_upper(Value) == Value;
    lower -> string:to_upper(Value) == Value

% Wire the validator in upper case mode...
wf:wire(ButtonID, TextBoxID, #validate { validators=[
  #custom { text="Must be uppercase", function=F, tag=upper }


text - (string)
The text to display if validation fails.
function - (fun)
An Erlang function that returns true if the value is valid, false if invalid. <br>fun(Tag, Value) -> 'true' or 'false'
tag - (Erlang term)
Tag value is passed into the custom validation function.

Date: 2013-10-03 13:40:51 CDT

Author: Rusty Klophaus (@rustyio)

Org version 7.8.02 with Emacs version 23

Validate XHTML 1.0


Note:To specify code blocks, just use the generic code block syntax:
<pre><code>your code here</code></pre>

comments powered by Disqus