Hide fields in FormBuider

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
aozuas

Hide fields in FormBuider

Post by aozuas »

Using version CMSMS 1.2
Formbuider 0.4.4
FormBrowser 0.2

I am using the data posted using a form created in Formbuider to control the clients contacts. Then I add I field in the form with the name "answers", where I want to add a info like "I have contacted this client" or something like that, using Formbrowser in admin area. But I don´t want to display that field in the site, so, reading the modul help, I found this:

"field->display 1 if the field should be displayed, 0 otherwise"

And a add that line into the Form Template:
{$answers->display = 0}

But didnt work and the field still appear in the site. Any help would be great.
Last edited by aozuas on Tue Nov 20, 2007 4:44 pm, edited 1 time in total.
aozuas

Re: Hide fields in FormBuider

Post by aozuas »

I change a bit the title of this post, for "Hide fields" instead of "Invisible field".
I also found two other users with the same problem, without solution, waiting for an answer.
Any help would be great.
aozuas

Re: Hide fields in FormBuider

Post by aozuas »

If a good soul could give me a hand in this subject, I will be gratefull!
aozuas

Re: Hide fields in FormBuider

Post by aozuas »

Now I tried something like that:

{$field->display->answers = 0}

without success.
If anyone know the correct syntax, please help.
aozuas

Re: Hide fields in FormBuider

Post by aozuas »

It is very important to me solve that, if anyone could help me I will be grateful.
alby

Re: Hide fields in FormBuider

Post by alby »

aozuas wrote: It is very important to me solve that, if anyone could help me I will be grateful.
I don't have FormBuilder here for try but it's smarty sintax and not php sintax:
For "assign" value to variable use assign function

Check your variables in loop with {$field|print_r}

maybe I mistake with other but I remember for hidden properties in FormBuilder

Alby
aozuas

Re: Hide fields in FormBuider

Post by aozuas »

Hi Alby. Yes, I know that is smarty syntax, I didn't say that was a PHP syntax problem.

I am already trying {$answers->display = 0} in the loop, as you suggest, but didn't work.

No, in FormBuilder I cant hide the fields, just the labels.

Look the template code that I alter (line include just after the {foreach from=$fields item=entry}:

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 $fb_submission_error}
		<div class="error_message">{$fb_submission_error}</div>
		{if $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 $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}
	{$fb_hidden}	
	<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}
		{$answers->display = 0}
		{if $entry->display == 1}
        	{strip}
         	{if $entry->needs_div == 1}
            	<div
            	{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}
         	{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 $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}
         	{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}
alby

Re: Hide fields in FormBuider

Post by alby »

aozuas wrote: Hi Alby. Yes, I know that is smarty syntax, I didn't say that was a PHP syntax problem.

I am already trying {$answers->display = 0} in the loop, as you suggest, but didn't work.
No I don't suggest this, it's no php:  $answers->display = 0
but MAYBE:  {assign var=$answers->display value=0}

aozuas wrote: No, in FormBuilder I cant hide the fields, just the labels.
Humm... strange I remember:  required, regexp, hidden, ..... properties of field
but maybe I remember wrong  :(


Display your all variables with:
aozuas wrote: {foreach from=$fields item=entry}
{$entry|print_r}
{if $entry->display == 1}
Alby
aozuas

Re: Hide fields in FormBuider

Post by aozuas »

Alby,

I used {assign var=$answers->display value=0}, but have no success.

{$entry|print_r} give me that:

stdClass Object ( [display] => 1 [required] => 0 [required_symbol] => [css_class] => [valid] => 1 [error] => [hide_name] => 0 [has_label] => 1 [needs_div] => 1 [name] => answer [input] => [smarty_eval] => 0 [input_id] => m3_24 [multiple_parts] => 0 [label_parts] => 1 [type] => Text Input ) 1


In advanced options of the field, I have this:
"Validation Regex:            "
"This regular expression will only be used if "validation type" is set to a regex-related option. Include a full Perl-style regex, including the start/stop slashes and flags (e.g., "/image\.(\d+)/i")"

Any idea?
aozuas

Re: Hide fields in FormBuider

Post by aozuas »

Hi Alby, what do you think?
alby

Re: Hide fields in FormBuider

Post by alby »

aozuas wrote: Hi Alby, what do you think?
I have a FormBuilder 0.4 and I don't find a hidden check  :(

Workaround:
- assign a css style to your field:  hidefield
- check "Hide Label"
- in your Style CSS add:  .hidefield { display:none; }

Ask to calguy1000 for this in recent release or better solution  :)

Alby
User avatar
mexican
Forum Members
Forum Members
Posts: 16
Joined: Wed Oct 10, 2007 2:34 am
Location: Guadalajara Mex.

Re: Hide fields in FormBuider

Post by mexican »

Hi.

I am having the same problem with form builder.

this is the post.
http://forum.cmsmadesimple.org/index.ph ... 557.0.html

in the help for the module i found this
Passing Default Values to Forms

Calguy added a nice feature, which is ........

{cms_module module='FormBuilder' form='my_form' value_FIELDNAME='default_value'}

This will set the field with FIELDNAME to 'default_value'.


and i am using this method to pass a value to my field.

Now.

It is possible to pass a property to a field in the same way ??

like 

{cms_module module='FormBuilder' form='my_form' property_FIELDNAME='default_property'}

maybe in this approach the field can be hiding since the suggested method ($field->display=0) doesn't seems tho work.
aozuas

Re: Hide fields in FormBuider

Post by aozuas »

Hi mexican

Did you try that solution you post?
{cms_module module='FormBuilder' form='my_form' property_FIELDNAME='default_property'}

Maybe that is the answer. I will try something like that, but I am without direction how to start.
A better documentation would be great.
Please, update here if you discover something.
User avatar
mexican
Forum Members
Forum Members
Posts: 16
Joined: Wed Oct 10, 2007 2:34 am
Location: Guadalajara Mex.

Re: Hide fields in FormBuider

Post by mexican »

I have tried a couple of combinations with no luck.

but it was only a question 

seems that the only thing that formbuilder doesn't can do is to hide fields

to bad
aozuas

Re: Hide fields in FormBuider

Post by aozuas »

Please, someone, help up in this topic: How to hide fields in FormBuider?
Locked

Return to “Modules/Add-Ons”