Developer forum

Forum » Development » user registration fields limitation

user registration fields limitation


Reply

Hi,

 

We are trying to prevent special characters in usernames. If we remove the validateFunctions tag, the validation should not occour for compulsory fields, nevertheless it does.

how can we manipulate this without having to change the external js file for e-mail and username validation? Do we have to create javascript functions and copy data from one place to another?

Regards,
Nuno

 


Replies

 
Reply

Have you tried something like:

 

<script language="javascript" type="text/javascript">

document.MyForm.onsubmit = MyValidation;

function MyValidation(){

//Do your validation here

}

</script>

 
Reply

Hi Lars,

 

Looks odd, but I can validate the form even eliminating the functions. It looks like the system runs my validation function and then runs Dynamicweb's validation, invalidating mine.

 
Reply

I assume this issue is related to frontend registration of Extranet users, right?

 

Could you post an example, so that I can see the HTML?

 
Reply

Hi Lars,

 

Take a look at this (development) website http://deltaq.dev.dynamicweb.pt/default.aspx?ID=23

 

If you access the backend we are using the Profile_DeltaQ_v2.htm template. We have tried using javascript to manipulate the functions, but it does not work.

 

Even if we do something like: < input type="submit" onClick="MyValidationFunction">

 

Javacsript

function MyValidationFunction {

 

  if (document.getElementByID(SomeCustomField).value <> "") {

    ValidateForm() //The Dynamicweb's validation function

  }

 

}

 

 

Dynamicweb still runs the validation function. If we want to prevent special characters in the username, or limit it to a certain number of characters, or even add another field as compulsory, is impossible.

 

If you need more details, let me know. Thanks in advance.

 

Nuno

 
Reply

Dynamicweb checks for required fields both client side and server side, so if you supress the Javascript validation, the server side validation will still be performed. You need something like:

 

if (ValidateForm()){

if (FieldDoesntContainSpecialCharacters){

return true;

}else{

alert("Don't use special characters in user name.");

return false;

}

}

 

So first run the DW validation and then your own validation.

 
Reply

Hi Lars,

 

I will try this new approach. Thanks!

 

Nuno

 
Reply

Please let me know if it works out for you:)

 
Reply

Hi Lars,

 

I only just picked it up today. Works fine, though I think the feature need some enhancements.

 

In the backend, fields like Phone and Zip code are limited to 20 and 10 characters. In the templates, the tags place input tags with no limitation, which result in errors when registring. There is the need to validate those fields through javascript.

 

Best Regards,

Nuno

 
Reply

You can just use similar validation.

 

<script>

    if (document.form1.field1.value.length > 20){

alert("Value won't fit in field.");

document.form1.field1.focus();

document.form1.field1.select();

}

</script>

 
Reply

Hi Lars,

 

Yes, that what I did to get it solved, nonetheless, the templates should either be prepared for it, or the input returned in the tags should already come with the maxlength html attribute. Another way to solve this general problem is to remove limitation to the back-end fields. These are just some suggestions.

 

Regards and once again, thank you,

Nuno

 
Reply

Oh, sure, you're right. We'll look in to that:)

 

You must be logged in to post in the forum