• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Issues with Radio Button Layout

Issues with Radio Button Layout 15 years 7 months ago #4384

  • acoghlan
  • acoghlan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Hi

I bought RSPro yesterday morning, and on the whole I am pretty happy with it. There are one or two things that are causing me a big headach though, and I consider these to be bugs that would be easy to fix in subsequent versions.

Specifically, I am trying to lay out a set of radio buttons in a vertical column. For reasons beyond the scope of this post, I need to set it so that the lable is on the left of the input element, not to the right. Whilst this is not too difficult to address with CSS, you have made it a challange by not including the pair of elements (the input and the label) in a single div or span. Furthermore, you have seperated them with a <br> tag when displaying in vertical mode. I realise that this may make it super easy for the less informed person to use the system, but it really limits how you can lay out the forms.

Can I suggest the following;
  • Rather than optionally using a <br> tag to do the vertical display, make it a choice between a <div> and a <span> tag.
  • Include a parameter that lets me give an id paramater to the <div> or <span> tag (although I can get around that through manually editing the form layout)
  • If letting me create the ID parameter is too much, hard code it in the same way you have hard coded the IDs of the radio button inputs, just with a different word (e.g. setBandingx or something similar).
These simple changes will make the system far more flexable.

For those that read this and want to change it themselves, For those that want to do this themselves, go to functions.php in the controller folder of the component. Edit the case 'radioGroup' option, which is in (approx) line 610 of the file to something like the following;
case 'radioGroup':
			{
				$i=0;
				$data=RSgetComponentProperties($componentId);
				$data['ITEMS']=str_replace(\&quot;\r\&quot;,\&quot;\&quot;,$data['ITEMS']);
				$items=explode(\&quot;\n\&quot;,$data['ITEMS']);
				foreach($items as $item)
				{
                    $out.= \&quot;&lt;div id=\\&quot;set$data[NAME]$i\\&quot;&gt;\&quot;;
					$item = stripslashes($item);
					$buf=explode(\&quot;|\&quot;,$item);
					if(count($buf)==1)
					{
						if(empty($value))
							if(preg_match('/\[c\]/',$buf[0]))
							{
								$v=str_replace('[c]','',$buf[0]);
								$out.=\&quot;&lt;input checked=\\&quot;checked\\&quot; type=\\&quot;radio\\&quot; value=\\&quot;$v\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot;/&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]&gt;$v&lt;/label&gt;\&quot;;
							}
							else
								$out.=\&quot;&lt;input type=\\&quot;radio\\&quot; value=\\&quot;$buf[0]\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]/&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot;&gt;$buf[0]&lt;/label&gt;\&quot;;
 
						else if(!empty($value[$data['NAME']]))
							if(str_replace('[c]','',$buf[0])==$value[$data['NAME']])
							{
								$v=str_replace('[c]','',$buf[0]);
								$out.=\&quot;&lt;input checked=\\&quot;checked\\&quot; type=\\&quot;radio\\&quot; value=\\&quot;$v\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]/&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot;&gt;$v&lt;/label&gt;\&quot;;
							}
							else
							{
								$v=str_replace('[c]','',$buf[0]);
								$out.=\&quot;&lt;input type=\\&quot;radio\\&quot; value=\\&quot;$v\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]/&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot;&gt;$v&lt;/label&gt;\&quot;;
							}
						else
						{
							$v=str_replace('[c]','',$buf[0]);
							$out.=\&quot;&lt;input type=\\&quot;radio\\&quot; value=\\&quot;$v\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot;/&gt;$v&lt;/label&gt;\&quot;;
						}
					}
					if(count($buf)==2)
					{
						if(empty($value))
							if(preg_match('/\[c\]/',$buf[1]))
							{
								$v=str_replace('[c]','',$buf[1]);
								$out.=\&quot;&lt;input checked=\\&quot;checked\\&quot; type=\\&quot;radio\\&quot; value=\\&quot;$buf[0]\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]/&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot;&gt;$v&lt;/label&gt;\&quot;;
							}
							else
								$out.=\&quot;&lt;input type=\\&quot;radio\\&quot; value=\\&quot;$buf[0]\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]/&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot;&gt;$buf[1]&lt;/label&gt;\&quot;;
 
						else if (!empty($value[$data['NAME']]))
							if(str_replace('[c]','',$buf[0])==$value[$data['NAME']])
							{
								$v=str_replace('[c]','',$buf[1]);
								$out.=\&quot;&lt;input checked=\\&quot;checked\\&quot; type=\\&quot;radio\\&quot; value=\\&quot;$buf[0]\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]/&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot;&gt;$v&lt;/label&gt;\&quot;;
							}
							else
							{
								$v=str_replace('[c]','',$buf[1]);
								$out.=\&quot;&lt;input type=\\&quot;radio\\&quot; value=\\&quot;$buf[0]\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]/&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot;&gt;$v&lt;/label&gt;\&quot;;
							}
						else
						{
							$v=str_replace('[c]','',$buf[1]);
							$out.=\&quot;&lt;input type=\\&quot;radio\\&quot; value=\\&quot;$buf[0]\\&quot; name =\\&quot;form[$data[NAME]]\\&quot; id=\\&quot;$data[NAME]$i\\&quot; $data[ADDITIONALATTRIBUTES]/&gt;&lt;label for=\\&quot;$data[NAME]$i\\&quot;&gt;$v&lt;/label&gt;\&quot;;
						}
 
 
					}
					$out.=\&quot;&lt;/div&gt;\&quot;;
					$i++;
				}
 
			}break;
The administrator has disabled public write access.

Re:Issues with Radio Button Layout 15 years 7 months ago #4391

  • richiep
  • richiep's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 131
Actually RSFrom Pro is set up to do this. When your editing your radio group notice the dropdown box that says \"vertical or Horizontal\".

That's all you have to do. No <br>'s required.

Good Luck
Richiep
The administrator has disabled public write access.

Re:Issues with Radio Button Layout 15 years 7 months ago #4403

  • acoghlan
  • acoghlan's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
I realise that you dont need to include the '<br/>'s as they are done by the code - that is actually my point! Hard coding the <br> tag into the code makes it VERY difficult to any heavily customised css formatting. The better way would be for you to change the code, and replace it with either <span> tags around each <input><label> combination for horizontal layout, or <div> tags for the vertical.

Also, it would be better html to include the <input> within the <label> tags - that would help further with formatting. (i.e. <label><input/></label>, as opposed to <input/><label/>)
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!