Forums

Form validation focus

Gaby_Staeheli 10 Apr, 2012
Dear Support

I hope you could help me with the following issue. I'd like to have if the validation is not valid then it focus on first error. I found some older posts on this forum and tried some solutions ,but so far nothing worked for me in IE properly. The error I get in IE is as soon you click on "submit" the browser seems not be able to focus on 1 error, so it keeps scrolling up n down fast and also "freeze", means I have to kill the process to close it.

I'd be thankful for any kind of idea or help.

Best Regards
GreyHead 10 Apr, 2012
Hi gaby,

First I suggest that you change your username so that your email is not displayed in the forums.

The problems you describe sound like a JavaScript error on the page. What do you see with the IE Web Developer tools?

Bob
Gaby_Staeheli 10 Apr, 2012
Hi Bob

Thanks for the notice and fast reply. I'm sorry to ask this stupid question, but where can I change my username? (at "Edit your Details" I'm only able to change my Name, Email, etc but not username).



About my Focus problem, well IE Web Developer tools doesn't show me any error on debug.

I found these 2 solutions so far:
File: components\com_chronocontact\js\livevalidation_standalone.js

Solution 1 Line 315: "this.element.focus();"
if(error instanceof Validate.Error){
  if( value !== '' || (value === '' && this.displayMessageWhenEmpty) ){
    this.validationFailed = true;
    this.message = error.message;
    this.element.focus();
    isValid = false;
  }
}



Solution 2 Line 58 "if(!valid)validations[i].element.focus();"
LiveValidation.massValidate = function(validations){
  var returnValue = true;
   for(var i = 0, len = validations.length; i < len; ++i ){
      var valid = validations[i].validate();
      if(returnValue) returnValue = valid;
      if(!valid)validations[i].element.focus();
   }
   return returnValue;
}


The first Solution gives me that Error I've described earlier in IE. The second solution doesn't make my IE go crazy but it ain't working perfect aswell (error messages disappears). But maybe you know a better solution to have the "Focus on error"

Regards
GreyHead 10 Apr, 2012
Hi Gaby,

Good question - Max changed some setting when we had a spam flood a few months back and it looks as though it may no longer be possible. PM me with the username you'd like and I'll try to change it from the site admin.

I've never seen the error focus problem you describe so don't have anything useful to suggest :-( Please post a link to the form so I can take a quick look.

Bob
Gaby_Staeheli 16 May, 2012
Hello

Sorry for the late response. First thanks for the name change and I haven't solved my problem yet, but it's in my queue and asap I'll post the link to show the error, just need to hold on a bit longer due some other things need to be finished first.


Kind Regards
Gaby_Staeheli 21 Jun, 2012
Hi

Here is the promised link to the form with the described Focus error.
As soon u click "submit" ur IE will go crazy and freeze.

http://46.127.94.126/Offerten-Telefonanlage.html

I hope someone could help or know a clean solution for the focus on error in forms.

Kind Regards
Gaby
GreyHead 22 Jun, 2012
Hi Gaby,

With the link you posted the focus jumped around the text inputs in IE9; I've never seen this behaviour before and had to kill IE9 from the task manager to stop it. If I go to the direct URL for the form everything looks OK so I assume that this is somehow a side effect of the way you have the form set up on the IP address URL.

Bob
Gaby_Staeheli 26 Jun, 2012
Hello

Yes that is the Error I meant and I forgot to tell don't use any other Link on that Site please as the Link i gave you (ip) is an local installed server and is used as a test version (only there is the test code) to show you that Error. I can't allow to have that Error on our real site.

But to shorten my Question, do you have any Idea or Solution to have a functionally "Focus on Error" Validation in Chronoforms formulars since my tries aren't working as you see🙂?

Thanks for your Help

Gaby
GreyHead 26 Jun, 2012
Hi Gaby,

The ChronoForms validation does focus on error and works OK. I have no idea what problem you are seeing but it seems to be more to do with your site than with ChronoForms :-(

Bob
Gaby_Staeheli 26 Jun, 2012
Ahh maybe could it be that our Version Joomla 1.5 + Chronoforms V3.2 is just to old and the Validation Focus was added in newer Versions ?

Kind Regards
Gaby
GreyHead 26 Jun, 2012
Hi Gaby,

In v3.2 it's set to onBlur by default. In v4 it's an option on the JS Validation tab if I remember correctly.

Bob
Gaby_Staeheli 27 Jun, 2012
Ok thanks for the help. I will check it out and may change the Version to v4.

Have a nice day

Kind Regards
Gaby
This topic is locked and no more replies can be posted.