[SOLVED] Can't style color of Formbuilder error messages

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
RyanC
Forum Members
Forum Members
Posts: 97
Joined: Fri Aug 05, 2011 9:02 pm

[SOLVED] Can't style color of Formbuilder error messages

Post by RyanC »

Hi, I'm using default Formbuilder template and style sheets. In the template, there is mention of classes called "error_message" and "error"... In my style sheet I have tried adding those classes to everything I can think of, li, ul, td, tr, table, p.... nothing changes.

My error messages remain the color of the "form" class--black.

I assume if that class is in the template, then adding that class in my css file would alter the appearance.

I want them to be red so that they stand out from the body text. Otherwise people may not see them. I would also like to make them smaller and italicize them.

Is there a way I can do this (without knowing php)?


Code: Select all

/* Sample FormBuilder CSS base */
 
 
 
 
 
#formWrapper li{
	width:400px;
}

#formWrapper {
	/*margin-left: 250px;*/
	margin: 0 auto;
	border: 2px solid  gray;
	width: 450px;
	
	padding: 10px;
	margin-bottom: 50px;
	/*float: right;*/
	margin-top: 20px;
	
    -webkit-border-radius: 10px;
    -khtml-border-radius: 10px;	
    -moz-border-radius: 10px;
    -border-radius: 10px;
    -moz-box-shadow: 6px 6px 6px #666;
    -webkit-box-shadow: 6px 6px 6px #666;
    -box-shadow: 6px 6px 6px #666;
    
    background-color: #FFFACD;
    background-color: #FFFBD7;
    
    
	
}

form {
	margin: 0 auto;
	font-size: 12px;
	color: black;
	line-height: 16px;
	 
	 
}


form div {margin-bottom:0}
fieldset div {
	margin-bottom:0.5em;

	
	 
}
fieldset div div {
	margin-top:0.5em;
	margin-left:1em;
	 
}
fieldset {
	margin-bottom:1em;
	border:1px solid #F60;
	padding:0.5em;
	
}
fieldset label {
	width:auto;
}
legend {
	color:#FFF;
	background:#F60;
	font-style:italic;
	font-size:1.2em;
	margin-bottom:0.5em;
	padding:0.2em;
	width:auto;
	border:1px solid #CCC
}
textarea {
	margin: 0.5em 0;
	width:98%;
	height: 6em;
	
}

/* Apply this class to text/select input fields with shorter labels
	to help alignment */
.short-label label {float:left; width:10em}
.short-label fieldset div input,
.short-label fieldset div select {width:16em}

/* Pretty up your Captcha image output */
.captcha  {
	margin:0.5em 0;
	width:200px;
	margin-left: 250px;
 }
.captchapict img {border:1px solid black; margin-bottom:0.5em;  
 }
.captcha input {width:196px; margin-top:0.5em}

/* Just a bit more room for the Submit button */
.submit {margin-top:10px;}

/* Apply this class to text/select input fields with shorter labels
	to help alignment */
.short-label label {float:left; width:10em}
.short-label fieldset div input,
.short-label fieldset div select {width:16em}

/* Pretty up your Captcha image output */
.captcha  {
	margin:0.5em 0;
	width:200px;
	text-align:center;
	
}
.captcha img {border:1px solid black; margin-bottom:0.5em; 
 
 }
.captcha input {width:196px; margin-top:0.5em;  }


 
.captchapict {
	border: 1px solid black;
}

 

/* Just a bit more room for the Submit button */
.submit {margin-top:10px;}

.contactform input {border: 1px solid #f60;}
.contactform input.checkbox {border: none;}
.contactform label {
	display: block;
	float: left;
	width: 150px;
	 
}
.contactform label.label {
	display: inline;
	float: none;
	width: 50px;
	font-size: 10px;
}
.contactform textarea {
	background-color: #ffc;
	border: 1px solid #f60;
}
.formbuilderform .message {
	line-height: 16px;
	padding: 0 0 8px 0;
}
 
 

Code: Select all

{* TABLE FORM LAYOUT / Field titles on Left *}
{* next line sets number of columns for things like checkbox groups *}
{assign var="cols" value="3"}
{literal}
 
<__script__ type="text/javascript">
function fbht(htid)
	{
		var fbhtc=document.getElementById(htid);
		if (fbhtc)
			{
			if (fbhtc.style.display == 'none')
				{
				fbhtc.style.display = 'inline';
				}
			else
				{
				fbhtc.style.display = 'none';
				}
			}
}
</__script>
{/literal}
{$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>*}
	{/if}
	{if $captcha_error}
		<div class="error_message">{$captcha_error}</div>
	{/if}

	{* and now the form itself *}
	{$fb_form_start}
	<div>{$fb_hidden}</div>

	<table{if $css_class != ''} class="{$css_class}"{/if}>
	{if $total_pages gt 1}<tr><td colspan="2">{$title_page_x_of_y}</td></tr>{/if}
	{foreach from=$fields item=entry}
		{if $entry->display == 1 &&
			$entry->type != '-Fieldset Start' &&
			$entry->type != '-Fieldset End' }
		<tr>
			{strip}
			<td align="right" valign="top"
			{if $entry->required == 1 || $entry->css_class != ''} class=" 
				{if $entry->required == 1}
					required
				{/if}
				{if $entry->required == 1 && $entry->css_class != ''} {/if}
				{if $entry->css_class != ''}
					{$entry->css_class}
				{/if}
				"
			{/if}
			>
			{if $entry->hide_name == 0}
				{$entry->name}
				{if $entry->required_symbol != ''}
					{$entry->required_symbol}
				{/if}
			{/if}
			</td><td align="left" valign="top"{if $entry->css_class != ''} class="{$entry->css_class}"{/if}>
			{if $entry->multiple_parts == 1}
			<table>
				<tr>
				{section name=numloop loop=$entry->input}
					<td>{$entry->input[numloop]->input}&nbsp;{$entry->input[numloop]->name}{if $entry->input[numloop]->op}&nbsp;{$entry->input[numloop]->op}{/if}</td>
					{if not ($smarty.section.numloop.rownum mod $cols)}
						{if not $smarty.section.numloop.last}
				</tr><tr>
						{/if}
					{/if}
					{if $smarty.section.numloop.last}
						{math equation = "n - a % n" n=$cols a=$entry->input|@count assign="cells"}
						{if $cells ne $cols}
							{section name=pad loop=$cells}
					<td>&nbsp;</td>
							{/section}
						{/if}
				</tr>
					{/if}
				{/section}
				</table>
			{else}
				{if $entry->smarty_eval == '1'}{eval var=$entry->input}{else}{$entry->input}{/if}
			{/if}
			{if $entry->valid == 0} <--- {$entry->error}{/if}
			{if $entry->helptext != ''}&nbsp;<a href="javascript:fbht('{$entry->field_helptext_id}')"><img src="modules/FormBuilder/images/info-small.gif" alt="Help" /></a>
					<span id="{$entry->field_helptext_id}" style="display:none" class="fbr_helptext">{$entry->helptext}</span>{/if}
			
			
			</td></tr>
			{/strip}
		{/if}
	{/foreach}
	{if $has_captcha == 1}
		 <td></td><td>{$graphic_captcha} <br /> {$input_captcha}{$title_captcha}</td></tr> 
	{/if}
		
		<tr><td>{$prev}</td><td><br />{$submit}</td></tr>
		 
		 
	</table>
	{$fb_form_end}
{/if}
{$fb_form_footer}
Last edited by RyanC on Fri Feb 10, 2012 4:15 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Can't style color of Formbuilder error messages

Post by Dr.CSS »

I would add some text here to see if it where the error messages come from, then wrap it in a span so you target it for styling...

{if $entry->valid == 0} <--- {$entry->error}some text{/if}

{if $entry->valid == 0} <span class='errortext'><--- {$entry->error}</span>{/if}
RyanC
Forum Members
Forum Members
Posts: 97
Joined: Fri Aug 05, 2011 9:02 pm

Re: Can't style color of Formbuilder error messages

Post by RyanC »

Ok thanks for that, hopefully I'll get a chance to try it today.
RyanC
Forum Members
Forum Members
Posts: 97
Joined: Fri Aug 05, 2011 9:02 pm

Re: Can't style color of Formbuilder error messages

Post by RyanC »

Thanks for the help, everything worked out great.

I had some other questions in here but I was able to fix them, I guess my cache hadn't cleared and the changes weren't showing up.
Post Reply

Return to “Layout and Design (CSS & HTML)”