Formbuilder - Radio buttons - more than 3 in a row

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
map_1961
Power Poster
Power Poster
Posts: 410
Joined: Fri Apr 20, 2007 7:26 pm

Formbuilder - Radio buttons - more than 3 in a row

Post by map_1961 »

Hi.

How to manage that in formbuilder form using radio buttons more than 3 items go into one row?

Thankx
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by paulbaker »

??? I don't understand the question. What happens at the moment? What should be happening? Screen shot might help?
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
map_1961
Power Poster
Power Poster
Posts: 410
Joined: Fri Apr 20, 2007 7:26 pm

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by map_1961 »

Paul Thx answering.

Pls visit: https://www.papageienpark-bochum.de/how ... like-shop/
I created a smal survey using formbuilder for it.
I choose field type "Radio button".

What everi tried to do to get more (!!) than three items in one line i could not succeed. If i add one more option (4, 5 ...) it breaks to a second line. Even if there is enough space to the right.

But for a survey like that its importand that the options stand in one line.

Maybe you find a solution?

Thx

MAP
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by paulbaker »

In your CSS try adding to the .form class:

Code: Select all

width: 100%;
This makes the table wider.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
map_1961
Power Poster
Power Poster
Posts: 410
Joined: Fri Apr 20, 2007 7:26 pm

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by map_1961 »

Thx Paul.

I will try and let u know if it works.

Kind regards

MAP
User avatar
map_1961
Power Poster
Power Poster
Posts: 410
Joined: Fri Apr 20, 2007 7:26 pm

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by map_1961 »

Paul.

Just tried. But the result is that the three items now are spread wider. A fourth item is breaked i a new line.
This is the code from the site:
-----
<table width="100%" border="1">
<tbody>
<tr>
<td>first element</td>

<td>second element
</td>

<td>third element</td>
</tr> (<--- this caused the problem)

<tr> (<--- this caused the problem)
<td>fourth element
</td><td>&nbsp;</td>

<td>&nbsp;</td>
</tr>
</tbody>
</table>

------

The problem is that the fourth element is forced to go to a new lione by the closing tag </tr> after the third element and the opeming of a new line by <tr> ... </tr>. If i delete the
</tr> (<--- this caused the problem)

<tr> (<--- this caused the problem)
between the third and the fourth element they get to one line.

Thx

MAP
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by velden »

I'm not sure about these options in FormBuilder but you might want to have a look at Calguys module CGBetterForms (CGBF). Though I still never used it I know it allows for complete freedom of layout. Unlike FormBuilder which uses some hard coded parts making it difficult sometimes to change layout. -> Read JoMorg's post below.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by paulbaker »

OK so try altering the template:
Extensions > Form Builder > [form name] > Form Template tab.
This is where the form is generated, you should be able to stop the generation of the next <tr>. Post the template if you like.

And yes, I have used CGBetterForms and it certainly is: better. :D
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by Jo Morg »

Ok I have to say something here. FormBuilder in NO WAY limits how you can layout a form. You can use ANY HTML you want as long as you use the id in this format:

Code: Select all

<input type="text" id="{actionid}{$fieldalias->input_id}" name="fname">
How you format it is up to you. Knowledge of HTML and CSS is required as usual.
[ rant mode ]
I understand that the module may not have a very thorough documentation, but I resent people saying one is better than the other.
I don't mind that people say they like better one than the other, but please be accurate: FormBuilder still has more options than CGBetterForms and in no way limits how you layout your form. I have built hundreds of forms already without limitations whatsoever. I have built full web applications using FB and LISE, so I'm sorry if this comes through as me being a bit upset, but honestly I don't thing the way the work of the FormBuilder devs is being portrait her is fair, to say the least.
[/ rant mode ]
Sorry for the rant but I had to take it off my chest...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by paulbaker »

Jo I apologise for causing offence, I did not mean to.

Let me expand on "better". I was writing HTML and simple forms, using first Perl and then PHP for years before I had even heard of CMS Made Simple. So I got used to writing the form tags and laying it out and then "connecting" with the back end for processing. This is how CGBetterForms works. You create the form first, then instruct the module to "scan" the form - it calculates what form fields are required and does all the "complicated" back end stuff. A completely different approach to FormBuilder. So CGBetterForms uses a work flow that is familiar to people used to writing HTML forms and it makes more sense to me.

Having said that, I have only used CGBetterForms once and I have used FormBuilder perhaps 20 times so I know it produces some great results.

And I have lots of respect for anyone that can write their own modules as I am yet to write any of my own.

As I have said before here, one of the many things I like about CMS Made Simple - there is almost always more than one way to do things.

:)
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by Jo Morg »

Paul, I didn't take offense, but it saddens me the way people put things.
You can still build the form first with FormBuilder, just not automate (yet) the backend.
However my point is that I don't mind people having opinions and liking one module better than the other, that's why there are many modules doing the same with different approaches, and I have made my own versions of some existing modules too when they didn't fit exactly my needs. That's all fine.
I always took as my policy, when people ask me about which modules to use for one thing or another, to enumerate all modules for a certain purpose without making a judgement as ultimately it's the user (designer/frontend developer, etc) who will decide which is the best for his own needs.
That's all... just needed to say that. Paul don't make much of it, I just had to vent... ;)
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
map_1961
Power Poster
Power Poster
Posts: 410
Joined: Fri Apr 20, 2007 7:26 pm

Re: Formbuilder - Radio buttons - more than 3 in a row

Post by map_1961 »

OK Sirs. Its obvious that you guys know mich more about code and modules like me stupid cmsms user.
I like to maintain working with formbuilder as i know a (very little) how to use ist.
This is the Form, template, Paul, as you proposed:

Code: Select all

{* TABLE FORM LAYOUT / Field titles on Top *}
{* 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 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>

	<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
			{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></tr><tr><td {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 isset($has_captcha) && $has_captcha == 1}
	
	    	<tr><td>{$graphic_captcha}</td></tr><tr><td>{$title_captcha}<br/>{$input_captcha}<br />&nbsp;</td></tr>
	{/if}
	<tr><td>{$prev}</td></tr><tr><td>{$submit}</td></tr>
</table>
{$fb_form_end}
{/if}
{$fb_form_footer}
I can detect using of some <tr> </tr> in there but - sorry 4 that: i can't read what this variables mean.
So if you find the place to delete let me know pls.

Thx

MAP
Post Reply

Return to “Modules/Add-Ons”