The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Limit characters for nicknames

Go down

Limit characters for nicknames Empty Limit characters for nicknames

Post by dudi November 13th 2011, 3:15 pm

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

Male Posts : 104
Reputation : 30
Language : English

Back to top Go down

Limit characters for nicknames Empty Re: Limit characters for nicknames

Post by Guest November 13th 2011, 3:22 pm

Do you use phpBB2? Smile
avatar
Guest
Guest


Back to top Go down

Limit characters for nicknames Empty Re: Limit characters for nicknames

Post by dudi November 13th 2011, 3:31 pm

Yes Smile
dudi
dudi
Forumember

Male Posts : 104
Reputation : 30
Language : English

Back to top Go down

Limit characters for nicknames Empty Re: Limit characters for nicknames

Post by Guest November 14th 2011, 11: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
avatar
Guest
Guest


Back to top Go down

Back to top

- Similar topics

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