Ajax validation never ending in Forms

Incremental

Member
Hello,
it was previously working, but now my contact form which has Ajax Validation, displays a never ending "Validating" spinner over filled elements.
Thanks for help !!!
 
which form is this on? Do you have any js errors in your console?
Don't think its the same issue, the other was specifically related to cdd elements - not ajax submit
 
No - of course this is NOT the same as the autocomplete issue.

Does this happen when you are typing / tabbing very slowly, or only when you e.g. end up having two validations running in parallel because you have tabbed quickly?

NOTE: There is definitely an issue with multiple ajax validations running simultaneously which I am working on.
 
You can see it on my Contact Form "Nous contacter"
  • type a single letter in the "Name" field and click in "Mail" field
  • type a single letter in the "Message" field and click in "Mail" field
There are now 2 never ending spinners with "Validating" and the fields are blanks.
I disabled all my Form plugins and it's the same !
This form is invoked through an article plugin :
{fabrik view=form id=4 contacts___ContactsFormID=1 show-title=0 layout=LBContactsFormPublic}

when I remove 'layout=LBContactsFormPublic' it works.
What I did in my Public template is hiding 'Admin' elements. I inserted the following code in default_group.php :
PHP:
foreach ($this->elements as $element) :
    // Filter Admin fields to hide (Like he is public)'
    switch ($element->id) {
        case contacts___IP_Address :
        case contacts___Status :
        case contacts___Answer :
        case contacts___AnswerDate :
        case contacts___Reply :
            continue 2;    // Continues foreach
    }
 
    $this->element = $element;
    $this->class = 'fabrikErrorMessage';

Would it be possible that validation is seeking for these fields (not created) ???
If yes, how to perform the same filtering in validation ?

Thanks a lot
 
Thanks for your reply
In my test site Contact Form "Nous contacter"
but I've changed the code of my template.
Instead of 'dropping' the element in the form, I've hidden it with the following code :
Code:
    $style = $element->hidden ? 'style="display:none"' : '';
    $span = $element->hidden ? '' : ' ' . $element->span;
 
    // LB : Filter elements to hide
    switch ($element->id) {
        case contacts___IP_Address :
        case contacts___Status :
        case contacts___Answer :
        case contacts___AnswerDate :
        case contacts___Reply :
            $style = 'style="display:none"';
            $span = '';
    }
    ?>
            <div class="control-group <?php echo $element->containerClass . $span; ?>" <?php echo $style?>>
and it works. But the elements I do not want to display in public form could be manipulated in the browser.

If you want, I can change back my code if you think validation could be modified to jump missing elements ?
 
I don't think that the branch I linked you to has a fix for that. But if you change it back so I can see what is happening then I will diagnose and code a fix.
 
I reverted the code. You can see it now.
As I mentioned at the beginning of my thread, it was working some weeks ago when I created my template.
Maybe something was changed in the validation process ?

Thanks for looking

PS : of course this code is inserted in standard View Form bootstrap
 
I found the page but don't get any contact form fields at all.

I checked the HTML and no form. The html that is there is:

HTML:
<article class="item">
<header>
<h1 class="title">Nous contacter</h1>
</header>
<div class="content clearfix">
<p class="dropcap">Pour toutes questions techniques ou commerciales, n&#39;h&eacute;sitez pas &agrave; nous envoyer un message gr&acirc;ce &agrave; ce formulaire contact...
<br /><br />
Nous vous r&eacute;pondrons dans les meilleurs d&eacute;lais.
</p>
<blockquote>contact form</blockquote>
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
</div>
</article>
 
You can see it on my Contact Form "Nous contacter"
  • type a single letter in the "Name" field and click in "Mail" field
  • type a single letter in the "Message" field and click in "Mail" field
There are now 2 never ending spinners with "Validating" and the fields are blanks.

Ok - I went to the beaupuis.com "Nous contacter" and followed the above, and the spinners did not get stuck. I tried it in Chrome and then IE with the same result.

It looks like the dbjoin has a recent fix of mine which has not yet made it to the main github, so I guess you may have applied the zip download I gave you a link to. If so, can you update from Fabrik github and I'll try it again.

S
 
Sophist,
when you're not logged in, it works.
But when you're logged in as Admin in the front-end, the spinners last.

You can find my login details in my Fabrik profile.
Thanks
 
Ok - I have logged in and recreated the error - and I am seeing some javascript console errors. As soon as I get the time, I will try to work out why you get these when logged in but not when you aren't.
 
I have taken another look (yes - I am a sad bloke doing this on NYD).

The first JS error message we get when we are logged in is "watch validation failed, could not find element contacts___Answer". There is no contacts___Answer field in the HTML, but there are several references to it (along with contacts___AnswerDate and contacts____Status fields) in the Fabrik code block. When we are logged in there is a watchValidation call on contacts___Answer which is not there when we are not logged in.

References to Fabrik elements that are not in the HTML should not appear in the Fabrik code block so it is definitely one or more bugs!! (Though this does not yet explain the validation errors.)

I suspect that what is triggering this bug is that you have defined these fields in Fabrik, but due to the Access levels you have set on these elements, they should not be shown (which is why they are not in the HTML) but due to the bug(s) they are still being added to the code block.

Next in the JS console we get an infinite loop "Uncaught TypeError: Cannot call method 'addClass' of null - textarea.js:217" which is in getTextContainer. I suspect that this is because there is an entry for the contacts___Answer textarea field in the addElements calls. So aside from fixing this element being added to the addElements code block, we should also code a test in addElements to check that fields exist in the HTML and if not we should display a single error message and avoid calling the elements js object.

The stuck validation spinner is caused by another JS error "Uncaught TypeError: Object #<error> has no method 'each' - date.js:430". I suspect that this is the AnswerDate field - when a validation is done, values of all elements are sent to the server (so they can be accessed by e.g. php validation), and I suspect that the AnswerDate update method is being called as part of the post-validation handling. If we fix the above two bugs, this should not occur.

So, having identified the causes I need to code and test the fixes - and to test it I need to recreate the issue myself. To help with this...

Can you please post here screen shots of the following:
  1. Access tab for the three elements above.
  2. In Joomla Admin User Manager, the User Groups screen, the Viewing Access Levels screen and the Viewing Access Levels Edit screen for whatever Access levels are selected for the three elements.
Many thanks. S
 
I'm probably another sad and passionate bloke like you ;-))
Thanks for your help and happy new year !

First of all, can you tell me how you get these conclusions. I'm working with Firefox and Firebug and I sometime get errors, but not in a reproductible way.
When I try to look errors, I get JS code out of the Fabrik context and have no clues relating to the Fabrik element.
What is the right method for debug ?

Please notice that I created this template to be able to hide elements to public AND to Administrator (otherwise he doesn't see the same form as Public when he's logged in).
Take in mind that my form has 2 groups : one for the contact, one for the admin's reply.
When displayed in frontend for public, only the group Contact should be seen (event by administrator)
When displayed in frontend administration pages after log in, both groups can be seen.
  • Designing 2 templates (Public and Admin) was the only thing I found to do that.
  • Filtering elements display was the only thing I found as it seems that there is no way to know in PHP the ACL user group.

1) Access tabs : same for
  • contacts___Answer
  • contacts___AnswerDate
  • contacts____Status
    Capture.PNG
2) User Group :
Capture1.PNG

Viewing Access Level :
Capture2.PNG

Capture3.PNG

Capture4.PNG
 
can you tell me how you get these conclusions. I'm working with Firefox and Firebug and I sometime get errors, but not in a reproductible way.
When I try to look errors, I get JS code out of the Fabrik context and have no clues relating to the Fabrik element.
What is the right method for debug ?
From memory here is how I tracked this down.
  1. Logged in and reproduced the problem. Saw there were JS errors which were causing the problem. (When a JS error occurs, that JS thread stops, so the code to remove the spinner was not being run. So Fabrik code needs to detect what is causing the issue and write a console error itself to avoid crashes.)
  2. Saved the HTML for the page when logged in and again when logged out and compared.
  3. Found a difference in the code block. Then found references to elements which did not exist in HTML. Since these elements obviously exist in Fabrik, the reason that they were not seen (and were different depending on logged in status) was obviously due to Access settings.
  4. Looked at what would happen in the JS when elements were in the code block and not in the HTML to see what would happen and how to test for an error and write an error message. Then did this fix so that when the server Access bug gives invalid HTML (elements in code block but not in HTML) then the JS will give a nice error message rather than crash.
Having decided what the root cause is and reduced the symptoms, I now need to reproduce the issue in order to be able to test a full solution - hence my request for more information.

What is the right method for debug ?

I do the following on my Dev environment (for these reasons):

  • Global Config/Server/Error Reporting = Maximum (get php notices)
  • Global Config/System/Cache = Off (ensure changes are reflected immediately in displayed pages - low volume so not a problem)
  • Fabrik/Options/Debugging/allow fabrikDebug = Debug JS (non-minified JS)

S
 
Please notice that I created this template to be able to hide elements to public AND to Administrator (otherwise he doesn't see the same form as Public when he's logged in).



Do you really mean a Template - or do you mean just Access levels? I agree that Access levels are the correct way to show different elements to Public / Administrators, but I do not see why you would need to create new Fabrik templates for it, and creating bespoke templates will result in a big maintenance overhead as Fabrik's own templates are changed.

Also not sure how you switch templates depending on user?

Take in mind that my form has 2 groups : one for the contact, one for the admin's answer.
When displayed in frontend for public, only the group Contact should be seen (event by administrator)
When displayed in frontend administration pages after log in, both groups can be seen.

Again, I think is a good design. However I don't see the second group in the HTML, so I assume that you have the Group access settings set to avoid showing this to Public and that the Fabrik userid I am using is not an Administrator? Can you post screen shots of the groups Access settings on the Details tab so I can use these to recreate the issue?

  • Designing 2 templates (Public and Admin) was the only thing I found to do that.
As above, not sure this is necessary or a good idea.
  • Filtering elements display was the only thing I found as it seems that there is no way to know in PHP the ACL user group.
I am sure that you can get the element or group model and call a method such as CanView or CanUse to decide this - but why do you need to use your own php at all rather than just rely on Fabrik's standard functionality?

2) User Group :
<screen shot>
Viewing Access Level :
<screen shot>
<screen shot>
<screen shot>
The purpose of user groups is to split users into distinct groups based on the functionality they need. Many of these are used by Joomla to control access to content editing, so if you want to give access to parts of your fabrik application without giving access to the CMS you may need to create new user groups (as I do on my site for customers and staff), but since you only want Public or Admin I am really unclear why you needed to create additional User Groups and Viewing Access Levels rather than use the standard ones.

So, if you want to show the Answer group to your Joomla Administrators, then you should be able to use Public for the Contact group and Special for the Answer group.

1) Access tabs : same for
  • contacts___Answer
  • contacts___AnswerDate
  • contacts____Status
<screen shot>
So based on the above, I would set all Access settings for elements in the Answer group to Special.
NOTE: This design (using a single record to hold both initial contact request and reply) implies that you only make one reply to a contact and that you don't want to relate multiple contact/replies from the same person together. (I assume that you have a reason not to just create an email to you from the initial contact request and then use email for the reply.) You will also need to be careful about updating your date fields so that e.g. the Contact date field is not updated when you send the reply etc.
Hope this helps. Please post your Group Access settings and advise what you have done in your bespoke templates so I can recreate.
S
 
Thank you for your reply

Do you really mean a Template - or do you mean just Access levels?

I use ACL + a Fabrik Form template http://www.fabrikar.com/forums/index.php?wiki/form-and-details-templates/

I've done this because when I am logged in as Admin in the Front-end and I go to my Public Form, I see all Admin group/elements which are hidden to Public.
I just want to see the Public Form like Public. So I designed a template Form which hides the Admin fields to everybody, especially to the Admin, becaus when I'm Public, the ACL works.

I agree that templating can cause maintenance problems. If you have a better solution, I'll get it.

The account I gave you is SuperUser and FabrikAdmin.
You can also use it in backend.

Do you have an idea to handle multiple replies to contacts ?
With SQL I understand it, but with Fabrik I don't see how to put the glue (how to link all replies to my List Contact rows).
Thanks
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top