• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Formbuilder Redirect Error If Form Not Filled In Correctly
PostPosted: Thu Apr 20, 2017 12:54 pm 
Offline
Forum Members
Forum Members

Joined: Tue Nov 22, 2011 2:22 pm
Posts: 111
CMS Made Simple™ 2.1.6 “Spanish Wells”
PHP Version 5.6.30
AceEditor2 1.05
AdminSearch 1.0.2
CGBlog 1.14
CGSimpleSmarty 2.1.6
CGSmartImage 1.21.8
CMSContentManager 1.1.4
CMSMailer 6.2.14
Captcha 0.5.5
DesignManager 1.1.1
FileManager 1.5.2
FormBuilder 0.8.1.6
JQueryTools 1.4.0.1
LISE 1.2.3
MenuManager 1.50.2
MicroTiny 2.0.3
ModuleManager 2.0.5
Navigator 1.0.3
News 2.50.6
Search 1.50.2
SiteMapMadeSimple 1.2.8
TinyMCE 3.1.4
Uploads 1.25.4.1

Odd query this one, it's to do with Formbuilder, Captcha and the detail template I have created in LISE.

If I do not fill in the form correctly I assumed that the page http://krb.govicinity.com/vacancies/acc ... r-312.html would simply reload and tell me the form had not been filled in properly (keeping it's current dynamically created LISE URL), but instead I am getting sent back to this page http://krb.govicinity.com/moduleinterface.php which I certainly do not want to go back to! It loses all the style of course, as my template for the individual job listing pages are mainly in a LISE detail template.

The form is not set to appear inline, but if I do do that it completely loses the form... which it would do as the form is in the detail template in LISE.

This website is complete apart from this issue.

08. Vacancies Smarty Page Only (the template for the page)
Code:
{process_pagedata}
<!DOCTYPE html>
<__html lang="en">
{content label='This is the smarty tag area - please do not touch this, you may break your site if you do' oneline='true' wysiwyg='false'}
</__html>
{/strip}


The LISE detail template
Code:
<head>
<meta name="description" content="{$item->fielddefs.description.value|truncate:150:true|strip_tags}" />
<meta name="keywords" content="{$item->fielddefs.description.value|truncate:150:true|strip_tags}" />
{metadata}
</head>

</__body class="{$page_alias}">
<div id="wrapper">

{global_content name='Header'}

<div class="wrapper-inner">

{* Start Content *}
<article>

<div class="single-column">

<h1>{$item->fielddefs.jobtitle.value}</h1>

<div class="double-column">
    <div class="grid-50">
        <p>Location: {$item->fielddefs.location.value} <br />
        Salary: {$item->fielddefs.salary.value}<br />
        Reference: {$item->fielddefs.jobreference.value}</p>
        {$item->fielddefs.description.value}
    </div>
    <div class="grid-50">
        <__iframe src="{$item->fielddefs.jobmap.value}" allowfullscreen class="job-map"></__iframe>
        {FormBuilder form='krb_job_form'}
    </div>
</div>

{assign var='alt_title' value=$entry->title}

</div>

</article>
{* End Content *}

</div>
</div>

{global_content name='Footer'}

{global_content name='Scroll_To_Top'}
{/strip}
<__body>

_________________
Going up, woop, woop.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Formbuilder Redirect Error If Form Not Filled In Correct
PostPosted: Thu Apr 20, 2017 1:40 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7278
Location: The Netherlands
This article describes the use and re-use of variables from modules and page templates
https://www.cmscanbesimple.org/blog/bas ... d-metatags

If you check the page source of your site you will see that the form is sent from the detailpage. To change this to the canonical URL you can replace it with Smarty like:
Code:
{Formbuilder|replace:'http://krb.govicinity.com/vacancy-details.html':$canonical_url ...}

Note: $canonical_url is an example of my tutorial I posted.

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Formbuilder Redirect Error If Form Not Filled In Correct
PostPosted: Thu Apr 20, 2017 3:23 pm 
Offline
Forum Members
Forum Members

Joined: Tue Nov 22, 2011 2:22 pm
Posts: 111
OK, so I now know why the page redirects to the default "container"/template page on submission:

Code:
<form id="cntnt01moduleform_1" method="post" action="http://krb.govicinity.com/vacancy-details.html" class="cms_form" enctype="multipart/form-data">


i.e. the form is pointing to the vacancy-details.html page rather than the actual dynamically created http://krb.govicinity.com/vacancies/acc ... r-312.html one, is there any way to make the system do this? Otherwise I am stuffed!

_________________
Going up, woop, woop.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Formbuilder Redirect Error If Form Not Filled In Correct
PostPosted: Thu Apr 20, 2017 4:39 pm 
Offline
Forum Members
Forum Members

Joined: Tue Nov 22, 2011 2:22 pm
Posts: 111
Thanks Rolf, I have taken some of what you have said and used it to make the URLs work well, if I did exactly as you said for some reason it still returned the http://krb.govicinity.com/vacancy-details.html URL.

Here's what I have done so far:

Above doctype:
Code:
{process_pagedata}
{$canonical_url = "{root_url}{$smarty.server.REQUEST_URI}" scope=global}

In head
Code:
<link rel="canonical" href="{$canonical_url}">

In formbuilder call:
Code:
{FormBuilder|replace:'http://krb.govicinity.com/vacancy-details.html':$canonical_url form='krb_job_form'}


So that's got the exact URL in now, is that OK, or will what I have done cause issues?

One thing still puzzles me though, when I submit the form incomplete the page reloads with nothing else on it at all but the form, so I guess it is losing the template I have in LISE which has all of the information in it about the job, the form, the header and footer etc. Is there any was to keep that all there? because I know at some point someone is going to submit the form wrongly, so I need to fix this.

So all that's in the page template that handles the actual job details is this:
Code:
{process_pagedata}
{$canonical_url = "{root_url}{$smarty.server.REQUEST_URI}" scope=global}
<!DOCTYPE html>
<__html lang="en">
{content label='This is the smarty tag area - please do not touch this, you may break your site if you do' oneline='true' wysiwyg='false'}
</__html>
{/strip}


Everything else is in a LISE detail template like this:
Code:
<head>
{strip}
<meta name="description" content="{$item->fielddefs.description.value|truncate:150:true|strip_tags}" />
<meta name="keywords" content="{$item->fielddefs.jobtitle.value}" />
<meta charset="UTF-8" />
<title>{$item->fielddefs.jobtitle.value} - {sitename}</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=no">
<meta name="googlebot" content="index,follow" />
<meta name="robots" content="index,follow" />
<meta name="revisit-after" content="7 Days" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta property="og:url" content="{root_url}{$smarty.server.REQUEST_URI}" />
<meta property="og:title" content="{$item->fielddefs.jobtitle.value}" />
<meta property="og:site_name" content="{sitename}"/>
{if !empty($Meta_Description)}
<meta property="og:description" content="{$Meta_Description}"/>
{/if}
<meta property="og:locale" content="en_GB" />
{cms_stylesheet}
{literal}
<__script__ src="http://krb.govicinity.com/js/modernizr.js" type="text/javascript"></__script>
<__script__ src="http://krb.govicinity.com/js/respond.min.js" type="text/javascript"></__script>
<__script__ src="http://krb.govicinity.com/js/jquery-2.2.4.min.js"></__script>
<__script__ src="http://krb.govicinity.com/js/easing.js" type="text/javascript"></__script>
<__script__ src="http://krb.govicinity.com/js/jquery.ui.totop.js" type="text/javascript"></__script>
<__script__ src="http://krb.govicinity.com/js/classie.js" type="text/javascript"></__script>
<__script__ src="http://krb.govicinity.com/js/smaller.js" type="text/javascript"></__script>
<__script__ type="text/javascript">
$(document).ready(function(e) {
 $('img').css('opacity',0); // hide all images
});
$(window).load(function() {
 $('img').animate({'opacity':1},800); // everything is loaded, fade images in
});
</__script>
<__script__ defer src="http://krb.govicinity.com/js/jquery.flexslider.js"></__script>

{/literal}
<link rel="canonical" href="{$canonical_url}">
{/strip}

</head>

</__body class="{$page_alias}">
<div id="wrapper">

{global_content name='Header'}

<div class="wrapper-inner">

{* Start Content *}
<article>

<div class="single-column">

<h1>{$item->fielddefs.jobtitle.value}</h1>

<div class="double-column">
    <div class="grid-50">
        <p>Location: {$item->fielddefs.location.value} <br />
        Salary: {$item->fielddefs.salary.value}<br />
        Reference: {$item->fielddefs.jobreference.value}</p>
        {$item->fielddefs.description.value}
    </div>
    <div class="grid-50">
        <__iframe src="{$item->fielddefs.jobmap.value}" allowfullscreen class="job-map"></__iframe>
        {FormBuilder|replace:'http://krb.govicinity.com/vacancy-details.html':$canonical_url form='krb_job_form'}
    </div>
</div>

</div>

</article>
{* End Content *}

</div>
</div>

{global_content name='Footer'}

{global_content name='Scroll_To_Top'}
{/strip}
<__body>

Any thoughts?

_________________
Going up, woop, woop.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Formbuilder Redirect Error If Form Not Filled In Correct
PostPosted: Thu Apr 20, 2017 6:28 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7278
Location: The Netherlands
Some templating basics:

1. The Core::Page template should build up your page lay-out and contain the < html >, < head > and < body > parts.

2. Module templates should only contain the code needed for the module output!

3. Call the modules *in* a Core content block.


For the use of template inheritance the {content} block should be parsed by Smarty. That is described in the blog post of mine mentioned above.


More useful information:
https://www.cmscanbesimple.org/blog/use ... ent-blocks

https://www.cmscanbesimple.org/blog/the ... gn-manager

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Formbuilder Redirect Error If Form Not Filled In Correct
PostPosted: Fri Apr 21, 2017 3:19 pm 
Offline
Forum Members
Forum Members

Joined: Tue Nov 22, 2011 2:22 pm
Posts: 111
OK, so gone back to basics on his now, used your template page layout Rolf, all working well apart from the canonicals still, I am pretty sure I have exactly as you have on your page.

Process pagedata
Code:
{process_pagedata}
{$canonical_url = "{$content_obj->GetURL()|lower|default:''}" scope=global}
{$root_url = "{root_url}" scope=global}
{$site_name = "{sitename}" scope=global}
{$page_description = "{description}" scope=global}
{$page_lang = 'en' scope=global}
{$page_title = "{title}" scope=global}
{$content = "{content label='This is the smarty tag area - please do not touch this, you may break your site if you do' oneline='true' wysiwyg='false'}" scope=global}


Global Metadata
Code:
<meta charset="UTF-8" />
<meta name="copyright" content="XXXXXX">
<meta name="description" content="{$page_description}">
<meta name="keywords" content="{$page_description}">
<link rel="canonical" href="{$canonical_url}">
{/literal}


LISE detail element
Code:
{$canonical_url = $entry->canonical|lower scope=global}
{$page_description = $entry->content|default:$entry->content|strip_tags|strip|truncate:150 scope=global}
{$page_title = $item->fielddefs.jobtitle.value scope=global}
<h1>{$page_title}</h1>
<p>Location: {$item->fielddefs.location.value} <br />
Salary: {$item->fielddefs.salary.value}<br />
Reference: {$item->fielddefs.jobreference.value}</p>
{$item->fielddefs.description.value}
<__iframe src="{$item->fielddefs.jobmap.value}" allowfullscreen class="job-map"></__iframe>


Head
Code:
<head>
<title>{$page_title} - {$site_name}</title>
<meta charset="utf-8">
{metadata}
{cms_stylesheet}
</head>


Body
Code:
</__body class="{$page_alias}">
<div id="wrapper">
{global_content name='Header'}
<div class="wrapper-inner">
{* Start Content *}
<article>
<div class="single-column two-column">
<div class="smarty-column">
<h1>{$page_title}</h1>
{$content}
</div>
{Formbuilder|replace:'http://krb.govicinity.com/vacancy-details.html':$canonical_url form='krb_job_form'}
</div>
</article>
{* End Content *}
</div>
</div>
{global_content name='Footer'}
{global_content name='Scroll_To_Top'}
<__body>
</__html>


So I have the page title coming in nicely, I have the content of the page filling the description and the keywords with the body content, the only thing I can see that's not working is the canonicals... and when you submit the page without filling it fully still it gets the summary results in it rather than keeping the job that was originally by the form (i.e. the job the form is actually about).

_________________
Going up, woop, woop.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Formbuilder Redirect Error If Form Not Filled In Correct
PostPosted: Mon Apr 24, 2017 10:45 am 
Offline
Forum Members
Forum Members

Joined: Tue Nov 22, 2011 2:22 pm
Posts: 111
So for a little more information on the detail vacancies page I have this smarty call:
Code:
{LISEVacancies orderby="item_position" detailpage="vacancy-details"}

To bring in the detail of the job, but as explained earlier, when you submit the sorm incorrectly the details of the job disappear and the summary is brounght into the page instead, I'm sure it's a simple coding slip from me, but I can't put my finger on it, the pages are set to not cache, see the page here and try it for yourself:
http://krb.govicinity.com/vacancies/bookkeeper-318.html

Even if I use replace on the form so that the URL stays the same it still seems to reload the summary in the left hand side of the column unfortunately.

_________________
Going up, woop, woop.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Formbuilder Redirect Error If Form Not Filled In Correct
PostPosted: Tue Apr 25, 2017 9:46 am 
Offline
Forum Members
Forum Members

Joined: Tue Nov 22, 2011 2:22 pm
Posts: 111
OK, so been scratching my head for about a week on this now, it seems that as the page refreshes on form submission (whether it is filled in correctly or not) then we get the summary load in the left part of the page where the detail job description was previously.

my work-around is this article on i-do-this:
https://www.i-do-this.com/blog/AJAX-For ... builder/57
That basically stops page reload on page submission using AJAX, credit to Ken Griffith for his solution, and also for being the saviour of my sanity, and to Rolf for his help on the template.

_________________
Going up, woop, woop.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting