• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Limit length of Occupation field?

#1
Is there a way to limit the length of the default user fields, like Occupation? I couldn't seem to find any options for them. Thanks!
 

Chris D

XenForo developer
Staff member
#2
The occupation field is already limited to 50 characters. That seems like a reasonable limit, to me, but it isn't configurable.

Theoretically you could limit it further by editing the template.

You would just change this:
Code:
<dd><input type="text" name="occupation" value="{$visitor.occupation}" id="ctrl_occupation" class="textCtrl OptOut" /></dd>
To this:
Code:
<dd><input type="text" name="occupation" value="{$visitor.occupation}" id="ctrl_occupation" class="textCtrl OptOut" maxlength="25" /></dd>
In the account_personal_details template.

Bear in mind, however, it wouldn't take much for those who are somewhat knowledgable to attempt to bypass that limit, so it certainly isn't infallible.

I should also point out that you will not be able to accept a length greater than 50. This limit is the maximum the database field is configured for and anything longer than 50 will be automatically truncated by our DataWriter.