The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Limit characters for nicknames

Go down

Limit characters for nicknames

Post by dudi on Sun Nov 13, 2011 8:15 am

Is there a way to limit characters only to a-z and numbers and few other marks like . [ ] | ?
avatar
dudi
Forumember

Male Posts : 104
Reputation : 30
Language : English

Back to top Go down

Re: Limit characters for nicknames

Post by Guest on Sun Nov 13, 2011 8:22 am

Do you use phpBB2? Smile

Guest
Guest


Back to top Go down

Re: Limit characters for nicknames

Post by dudi on Sun Nov 13, 2011 8:31 am

Yes Smile
avatar
dudi
Forumember

Male Posts : 104
Reputation : 30
Language : English

Back to top Go down

Re: Limit characters for nicknames

Post by Guest on Mon Nov 14, 2011 4:26 pm

Add this code in your JavaScript management:
Code:
var regx_chr = /^([A-Za-z\[\]\?\|\.]+)$/;

function checkForm() {
  var inpbox = document.getElementsByClassName('post').value;
  if(inpbox.search(regx_chr) == -1) {
    alert('Adaugti cel putin un caracter.\n Doar litere, [, ], |, ?, .');
    return false;
  }
}

document.getElementById('register').onsubmit = checkForm;
Then in your Administration Panel => Display => Templates =>Profile => profile_add_body => Edit
Find:
Code:
<!-- BEGIN switch_namechange_allowed -->
   <tr>
      <td class="row1" width="38%"><span class="gen">{L_USERNAME} : *</span></td>
      <td class="row2"><input class="post" type="text" name="username" value="Using php in posts is called being a smart [Language]... Stop it" size="25" maxlength="25" /></td>
   </tr>
   <!-- END switch_namechange_allowed -->
see - size="25" maxlength="25", change the underline numbers with maximum number of characters you want. Wink

Guest
Guest


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum