<solved>looking to affect output of Formbuilder error page

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
RyanC
Forum Members
Forum Members
Posts: 97
Joined: Fri Aug 05, 2011 9:02 pm

<solved>looking to affect output of Formbuilder error page

Post by RyanC »

Hi, for my Formbuilder form, when you hit submit without entering all the required information, not only do you get an arrow pointing next to the required field, but at the beginning of the document you get large text saying what that field already says.

So, is there a way to get rid of that large text at the top, and just keep the errors that have the arrow next to them, next to the actual field that needs attention?

Also can I change the size/color of the text that says "<-- Please enter a value for " ?
Last edited by RyanC on Tue Feb 07, 2012 8:36 pm, edited 1 time in total.
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: looking to affect output of Formbuilder error page

Post by spcherub »

All of these can be done by adding/editing the associated CSS or by editing the form template. The developer left all the options in so that the user (you in this case) can customize the form to your specific needs. Some people like all the error message grouped and some like then in content (like you do).

In the FomBuilder section of the CMS Admin, you can edit the form template and remove or comment out the area on the top of the template that displays all the error messages grouped together.

Alternatively, you can add the following to the CSS and that will hide that section:

Code: Select all

div.error_message div.error {display:none;}
Hope that helps.
-S
RyanC
Forum Members
Forum Members
Posts: 97
Joined: Fri Aug 05, 2011 9:02 pm

Re: looking to affect output of Formbuilder error page

Post by RyanC »

Thanks for the response.

Which part of this would get commented out? I guess my problem is I don't know anything about php. I only know HTML. So I don't know what I'm looking at here. I recognize the html tags but I don't know what the other stuff on the page is.

Code: Select all

$fb_form_header}
{if $fb_form_done == 1}
	{* This first section is for displaying submission errors *}
	{if $fb_submission_error}
		<div class="error_message">{$fb_submission_error}</div>
		{if $fb_show_submission_errors}
			<table class="error">
			{foreach from=$fb_submission_error_list item=thisErr}
				<tr><td>{$thisErr}</td></tr>
			{/foreach}
			</table>
		{/if}
	{/if}
{else}
	{* this section is for displaying the form *}
	{* we start with validation errors *}
	{if $fb_form_has_validation_errors}
		<div class="error_message">
		<ul>
		{foreach from=$fb_form_validation_errors item=thisErr}
			<li>{$thisErr}</li>
		{/foreach}
		</ul>
		</div>
I added your css tag to my styles and it didn't have an effect, and I also tried putting it inline into the template document itself... I just copied and pasted directly :

Code: Select all

div.error_message div.error {display:none;}
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: looking to affect output of Formbuilder error page

Post by Gregor »

words between {* *} are comment, as fas as I know, it's called Smarty logic.

Gregor
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: looking to affect output of Formbuilder error page

Post by spcherub »

@RyanC - Here is what you can comment out (from the code excerpt you posted) - I've commented out the code towards the bottom.

Code: Select all

$fb_form_header}
{if $fb_form_done == 1}
   {* This first section is for displaying submission errors *}
   {if $fb_submission_error}
      <div class="error_message">{$fb_submission_error}</div>
      {if $fb_show_submission_errors}
         <table class="error">
         {foreach from=$fb_submission_error_list item=thisErr}
            <tr><td>{$thisErr}</td></tr>
         {/foreach}
         </table>
      {/if}
   {/if}
{else}
   {* this section is for displaying the form *}
   {* we start with validation errors *}
   {if $fb_form_has_validation_errors}
      {*<div class="error_message">
      <ul>
      {foreach from=$fb_form_validation_errors item=thisErr}
         <li>{$thisErr}</li>
      {/foreach}
      </ul>
      </div>*}
RyanC
Forum Members
Forum Members
Posts: 97
Joined: Fri Aug 05, 2011 9:02 pm

Re: looking to affect output of Formbuilder error page

Post by RyanC »

Great! Thanks spcherub. :)
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: <solved>looking to affect output of Formbuilder error pa

Post by ladyr0gue »

Dear spcherub... I am trying to do exactly the opposite of what Ryan did - I like the error messages at the top but not in the content as it mucks up my form layout. Please could you show me exactly where to comment out the other error messages? Sorry I have tried countless ways and can't seem to figure it out! ???

I think it's the same as Ryan's, here it is {* DEFAULT FORM LAYOUT / pure CSS *}
{$fb_form_header}
{if $fb_form_done == 1}
{* This first section is for displaying submission errors *}
{if isset($fb_submission_error) && $fb_submission_error}
<div class="error_message">{$fb_submission_error}</div>
{if isset($fb_show_submission_errors) && $fb_show_submission_errors}
<div class="error"><ul>
{foreach from=$fb_submission_error_list item=thisErr}
<li>{$thisErr}</li>
{/foreach}
</ul>
</div>
{/if}
{/if}
{else}
{* this section is for displaying the form *}
{* we start with validation errors *}
{if isset($fb_form_has_validation_errors) && $fb_form_has_validation_errors}
<div class="error_message">
<ul>
{foreach from=$fb_form_validation_errors item=thisErr}
<li>{$thisErr}</li>
{/foreach}
</ul>
</div>
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: <solved>looking to affect output of Formbuilder error pa

Post by spcherub »

@ladyr0gue - Please post your entire form template here and I can show you what you can comment out or delete. Also in your case I think it may be easier to suppress the error messages with the CSS, but we acn figure that out when you post the template.

-Sanjay
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: <solved>looking to affect output of Formbuilder error pa

Post by spcherub »

@ladyr0gue -

Assuming you are using one of the default templates, here what you can do - the code you need to comment out is towards the bottom - search for the text ladyr0gue in the following code and you will see where the code has been commented out.

Code: Select all

{* DEFAULT FORM LAYOUT / pure CSS *}
{$fb_form_header}
{if $fb_form_done == 1}
	{* This first section is for displaying submission errors *}
	{if isset($fb_submission_error) && $fb_submission_error}
		<div class="error_message">{$fb_submission_error}</div>
		{if isset($fb_show_submission_errors) && $fb_show_submission_errors}
			<div class="error">
			<ul>
			{foreach from=$fb_submission_error_list item=thisErr}
				<li>{$thisErr}</li>
			{/foreach}
			</ul>
		</div>
		{/if}
	{/if}
{else}
	{* this section is for displaying the form *}
	{* we start with validation errors *}
	{if isset($fb_form_has_validation_errors) && $fb_form_has_validation_errors}
		<div class="error_message">
		<ul>
		{foreach from=$fb_form_validation_errors item=thisErr}
			<li>{$thisErr}</li>
		{/foreach}
		</ul>
		</div>
	{/if}
	{if isset($captcha_error) && $captcha_error}
		<div class="error_message">{$captcha_error}</div>
	{/if}

	{* and now the form itself *}
	{$fb_form_start}
	<div>{$fb_hidden}</div>
	<div{if $css_class != ''} class="{$css_class}"{/if}>
	{if $total_pages gt 1}<span>{$title_page_x_of_y}</span>{/if}
	{foreach from=$fields item=entry}
		{if $entry->display == 1}
        	{strip}
         	{if $entry->needs_div == 1}
            	<div
            	{if $entry->required == 1 || $entry->css_class != '' || $entry->valid == 0} class="
              		{if $entry->required == 1}required{/if}
              		{if $entry->css_class != ''} {$entry->css_class}{/if}
                    {if $entry->valid == 0} fb_invalid{/if}
              		"
            	{/if}
            	>
         	{/if}
         	{if $entry->hide_name == 0}
            	<label{if $entry->multiple_parts != 1} for="{$entry->input_id}"{/if}>{$entry->name}
            	{if $entry->required_symbol != ''}
               		{$entry->required_symbol}
            	{/if}
            	</label>
         	{/if}
         	{if $entry->multiple_parts == 1}
            	{section name=numloop loop=$entry->input}
               		{if $entry->label_parts == 1}
               			<div>{$entry->input[numloop]->input} {$entry->input[numloop]->name}</div>
               		{else}
               			{$entry->input[numloop]->input}
               		{/if}
               		{if isset($entry->input[numloop]->op) && $entry->input[numloop]->op}{$entry->input[numloop]->op}{/if}
            	{/section}
         	{else}
            	{if $entry->smarty_eval == '1'}{eval var=$entry->input}{else}{$entry->input}{/if}
         	{/if}
         	{* commented out for ladyr0gue if $entry->valid == 0} <--- {$entry->error}{/if *}
         	{if $entry->needs_div == 1}
            	</div>
         	{/if}
         	{/strip}
     	{/if}
	{/foreach}
	{if $has_captcha == 1}
		<div class="captcha">{$graphic_captcha}{$title_captcha}<br />{$input_captcha}</div>
	{/if}
	<div class="submit">{$prev}{$submit}</div>
	</div>
	{$fb_form_end}
{/if}
{$fb_form_footer}
Hope this helps
-Sanjay
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: <solved>looking to affect output of Formbuilder error pa

Post by ladyr0gue »

Thank you! Legend, that's exactly what I needed :) php is not my friend ^-^
Post Reply

Return to “The Lounge”