Form submission problems

Hi All,


Has anyone out there ever experenced issues with forms not submitting?? other than ppl not filling in all the required fields :wink: - even if you nest a form into another page??



We have had several episodes where this is this case & it’s starting to cause a stink. Each time the forms were test extensivly (esp. the last one)



There are possibly other factors that come into play, amoungst them is something we have called Novell Access Manager: an access management product for single sign-on etc. But I’m told this couldn’t be the reason <_<.



Cheers Julian

When you say not submitting do you mean the request is not being sent, or perhaps users returned to the form page on submit? There are several factors that could come into play, off the top of my head caching can cause real issues with form submission, particularly if the form is nested into the content of another page (which will generate additional matrix cache).

[quote]
When you say not submitting do you mean the request is not being sent, or perhaps users returned to the form page on submit? [/quote]



No submission is recorded, & the user is returned to the page with no error messages displayed. So it looks like you're going around in circles :frowning:



Are there any spamming counter measures in a standard form, some sort of hidden field with a secret key?? - couldn't see any?



We tested the last form extensively before releasing, & it worked flawlessly. But after making it visable to the whole world no submissions were recieved - untill I changed the page to include "/_nocache" into the URL.

Any chance the form is something we can view? Off the top of my head some things which can affect submission would be the server side form errors not showing (%form_errors% keyword), javascript overriding the submit event or altering submitted data - or perhaps customised form output missing the %submit_button% keyword, usually replaced with a custom submit button with a different name (which will sometimes prevent the form from being processed).

It’s located here: http://www.cpit.ac.nz/explore-your-options well actually here (after you pass in a tour time): http://www.cpit.ac.nz/explore-your-options/registration?campustour=1


I didn’t customise the form, so the output should be standard Squiz format, but it’s nested inside of a standard page.

There are a couple of things I can see that might be causing an issue:


This javascript:

    
    $('#q81578_q18_1,#q81578_q18_0,table tr:nth-child(2) ul li:nth-child(2)').css('display','none');


It's hiding form elements from display, which will cause their values not to be submitted with the form. To hide something from display we usually do something like this:

    
    /* CSS */
    .screenHide {
    position: absolute;
    left: -9999px;
    overflow: hidden;
    height: 1px;
    width: 1px;
    }

(the height,width,overflow hidden get around some ie issues if you have them, but aren't strictly necessary)

then your js would be:
    
    $('#q81578_q18_1,#q81578_q18_0,table tr:nth-child(2) ul li:nth-child(2)').addClass('screenHide');


The other issue may be nesting the content into a standard page. On doing that with caching enabled you may see cached version of the custom form (depending on your caching settings etc).

To troubleshoot this further you may need to try it directly on the custom form asset, without javascript. If it submits, then you know the issue is either with the javascript or the nesting and you can narrow it down further.

[quote]
This javascript:

    
    $('#q81578_q18_1,#q81578_q18_0,table tr:nth-child(2) ul li:nth-child(2)').css('display','none');


It's hiding form elements from display, which will cause their values not to be submitted with the form.
[/quote]

Yeah it effectively removes it from the DOM (as I found out with another form, some times I use visible: hidden; - but I like your method, it's safer :rolleyes: ), but as this wasn't a required field it *shouldn't* affect the function of the form.

I am really mistified as to why a form (in working condition) is nested inside another page (even when that page it's self is cached) wouldn't work, unless there was some sort of spam counter measures inside of the form (session var or public key) that was unique for every session, which need to go along for the ride.<_<

I've made a clone of the form & done some customising of the body copy, to add in my CSS & JS & remove the *nesting*. So far in testing it appears be to going perfectly (but then so did the previous one), so I guess time will tell with this one.

Cheers

Standard pages cache their content statically, no matter what it is. They don't have any understanding of what is being nested into them via nest content DIVs.



When you nest in things like asset listings, the dynamic functions (pagination and sorting) change the URL via query string variables. So a new copy of the cache is generated.



When you nest in forms (custom, asset builder, etc) the URL does not change because the data is POSTed. So the standard page is asked to print itself again but does not bother asking each nested content DIV to print because it already has a full-page cache for the current URL.

[quote]
So the standard page is asked to print itself again but does not bother asking each nested content DIV to print because it already has a full-page cache for the current URL.

[/quote]



Aaahh, so effectively due to all the URL rewriting/caching that matrix does there is no handler for the POSTing of the form. Righto I see now.:smiley:



many thanks,



Note to All: Don't nest forms !!!

don't nest forms?


… are you serious? … that's messed-up

[quote]
don't nest forms?



… are you serious? … that's messed-up

[/quote]



Maybe a better message is: don't nest forms inside standard pages when you have Matrix caching turned on. Instead, nest them inside designs, or nest the content of the standard page into the form instead.



All Matrix assets have ways to customise pretty much everything that goes to the frontend, so there is generally no need to nest dynamic form based assets into static assets. If you find a need, I'm sure someone in the community will come up with a clever way to not require it.

[font="Arial"]thanks a lot…


Would it be possible to get some advice from you on the best way to implement the following:



  • We need to create four main forms.
    [*]All of the four foms have a number of common sections that are identical.
    [*]Each main form is implemented as a custom-form.
    [*]We decided to implement the common sections as custom-forms nested inside each main form.


Thats when i discovered that the submit functionality was failing.
At that point i began searching the forums and found this thread.

I was hoping that the entire form with nested elements would function as a single form including submission
behaviour and field values and the %form_errors% field, etc..[/font]

[quote]


  • We need to create four main forms.
    [*]All of the four foms have a number of common sections that are identical.
    [*]Each main form is implemented as a custom-form.
    [*]We decided to implement the common sections as custom-forms nested inside each main form.

[/quote]

If you have common sections that are used between each form, why not use the built in form "Section"? Sections are intended to be linked into other forms and used across many different form assets.

[quote]
Thats when i discovered that the submit functionality was failing.

At that point i began searching the forums and found this thread.



I was hoping that the entire form with nested elements would function as a single form including submission

behaviour and field values and the %form_errors% field, etc…

[/quote]



Your problem is that you are printing 4 different forms on a page. Your assumption that Matrix will treat them as one big form is incorrect. But Matrix completely supports content and question sharing in forms. Just structure them using sections, as Nic has said, and you can link those sections (using the asset map) into as many other forms as you want. This works the same way as sharing the content of DIV assets between pages.



Some people find it easier to create a "master" custom form, with lots of sections, stored outside a site so it has no URL. Then they just reuse the sections stored in that master form in whatever custom forms they are creating. An admin can change the questions in a master custom form at any time and have them instantly reflected everywhere else they are used.

[font=ā€œArialā€]
thanks a lot guys…your help is greatly appreciated.



related thread

[/font]