validator_base_page_path_unique (zotonic_mod_base v1.0.0-rc.17)
A validator to check whether a resource’s page path is unique:
<input type="text" id="page_path" name="page_path" value="">
{% validate id="page_path" type={page_path_unique} %}Optionally, pass an id parameter to exclude that particular id when testing for uniqueness. This is useful when you
want to exclude the page paths of the resource currently being edited:
<input type="text" id="page_path" name="page_path" value="">
{% validate id="page_path" type={page_path_unique id=id} %}You can also pass a failure_message:
<input type="text" id="page_path" name="page_path" value="">
{% validate id="page_path" type={page_path_unique id=id failure_message=_"Eek! Already used!"} %}See also
Summary
Functions
-spec validate(page_path_unique, binary(), term(), list(), z:context()) -> {{ok, binary()}, z:context()} | {{error, m_rsc:resource(), atom() | binary()}, #context{cowreq :: cowboy_req:req() | undefined, cowenv :: cowboy_middleware:env() | undefined, site :: atom(), controller_module :: atom() | undefined, client_id :: binary() | undefined, client_topic :: mqtt_sessions:topic() | undefined, routing_id :: binary() | undefined, acl :: term() | admin | undefined, acl_is_read_only :: boolean(), user_id :: integer() | authenticated | undefined, render_state :: undefined | z_render:render_state(), db :: {atom(), atom()} | undefined, dbc :: pid() | undefined, language :: [atom()], tz :: binary(), props :: map(), depcache :: pid() | atom(), dispatcher :: pid() | atom(), template_server :: pid() | atom(), scomp_server :: pid() | atom(), dropbox_server :: pid() | atom(), pivot_server :: pid() | atom(), module_indexer :: pid() | atom(), translation_table :: atom()}}.