Problem with form block within a stack

Permalink
I've wanted for sometime to be able to include the built in contact form block on my contact page and duplicate it on other pages of my site via a modal popup window.

Previously doing this meant at least alterring the existing form blocks code and I wanted a solution that didn't involve alterring any core or block code.

By experimenting with the new stacks & gloabl areas in 5.5 I've managed to do this but am having one issue.

The method I used was to create a stack with a standard form block in and add this to my contact page. I then harcoded a new global area in the theme wrapped in a jquery popup. I then added the stack with the contact form to the gloabl area (a stack within a stack). Every page now has the same contact form as the contact page but in a nice popup window. The form submits fine and I have captured the submit event in jquery to simply handle validation to prevent page reloads closing the popup.

The issue I am having is with the version of the form on the contact page added directly from the stack. If javascript is enabled this all works fine but if it is disabled when the form reloads to report missing required fields it redirects to the cID of the system page created for the stack. The result is a dashboard style page (even if not logged in) with a page not found error. If none of the required fields are left empty it submits without javascript ok.

It seems as though a successful form submit is going to the right place but an unsuccessful submit is going to the wrong place.

Any ideas?

-Thanks.

digirunt
 
12345j replied on at Permalink Reply
12345j
id report it in the bugs first,
then i'd modify the controller of the page forbidden stacks page to go to the referring url if the requested url is a parent of the stacks page. something like
if(Page::getCurrentPage->getCollectionParentID()=='id of the stacks parent page'){
Header('location: '.$_SERVER['HTTP_REFERER']);
}

but definitely report this as a bug with stacks, my solution isn't very elegant.
digirunt replied on at Permalink Reply
digirunt
Thanks, I've added it as a bug. As i'm doing validation through jquery its not a big problem but it would be for anyone using the built in validation.