[ic] Meta information edit --- text entry --- MAXLENGTH?

John Young interchange-users@icdevgroup.org
Tue Jul 1 15:29:01 2003

John Matecsa asked:

>>On the "Meta information edit" form, for Widget type "Text entry", one
>>can specify a Width, which in HTML terms is the SIZE.
>>How does one specify in HTML terms the MAXLENGTH?
>>We would like to block the user from typing in more characters than the
>>field can hold?

and then Xavier GILLET replied:

 > <input type="text" name="name" value="value" size="XXX" maxlength="XXX" >

I'm guessing John Matecsa already knows about the maxlength field
in an <input>, and is asking more about using the Admin UI (since
he mentioned "MAXLENGTH" in his question).

I don't use the Admin UI, so I can't answer about the meta information
editor, but if it can't add maxlength, then just manually edit the HTML
page per Xavier's example.

Keep in mind, however, that maxlength is only good for the casual
visitor.  A semi-talented malicious visitor can easily submit a
form variable which exceeds a maxlength'd field.  To protect against that,
you need to filter the input.

You can filter at the catalog configuration level or per instance in a page.
That is, assuming your form variable has name="myformvar", and your 
is 24, you can use (depending on which variable space you are using):

[cgi name=myformvar filter=24] or [value name=myformvar filter=24]

or, in catalog.cfg:

Filter myformvar "24"

Other filter can be added, such as:

Filter myformvar "strip 24"  (which removes leading and trailing 

Many filters exist, and you can even create your own.  See the docs 
(ictags) and/or
~interch/code/Filter/* and ~interch/lib/Vend/Interpolate.pm.

John Young