Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Radio Buttons in Columns

Featured Replies

I have a rather long list of values that I am going to set up as radio buttons. Is there a way to display these in two columns (taking up less screen space) than in one long column?

Thanks.

Version: v6.x

Platform: Windows 2000

Resize the field. FM will change the number of columns automatically.

You will need to use a little bit of Javascript for this:

<table><tr>



<script>i = 1 ; nCols = 3 ;[FMP-Record]



if ((i % nCols) == 0)



        { document.write("<td>[FMP-Field:name]</td></tr><tr>") ; }



else



        { document.write("<td>[FMP-Field:name]</td>") ; } ;



i++ ;[/FMP-Record]



</script></tr></table>

This example is for three colums.

Hope this helps.

Garry

  • Author

Okay, Garry, remember you're dealing with a program illiterate here.

Sample question: Field Name--HiDegree

What is the highest degree you have earned?

Response options:

B.A.

B.S.

M.A.

M.S.

J.D.

Ph.D.

M.D.

<table><tr><script>i = 1 ; nCols = 3 ;

[FMP-Record]if ((i % nCols) == 0) { document.write("<td>

[FMP-Field:HiDegree]</td></tr><tr>") ; }

else { document.write("<td>

[FMP-Field:HiDegree]</td>") ; } ;i++ ;

[/FMP-Record]</script></tr></table>

I think I missed something in the translatin again. Surprise!! laugh.gif

Give this one a go smile.gif

<table><tr>

<script>i = 1; nCols = 3;

[FMP-ValueList: HiDegree, List=Degrees]

if ((i % nCols) == 0)

	{ document.write('<td><input type="radio" name="HiDegree" value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem]</td></tr><tr>');}

else

	{ document.write('<td><input type="radio" name="HiDegree" value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem]</td>');};

i++;

[/FMP-ValueList]

</script></tr></table>

Good Luck.

Garry

Hi, E.D.! Using the ValueList is generally better so you don't have to change your web stuff if anything changes, but since your degrees list does not look like it would change much, you can also just hard code the radio buttons in a table if you like with any number of columns/rows you like. Make sure every button has the same name as the field but with different values and don't use the FMP-ValueList option at all. (Although Garry's JavaScript is awesome and I'm gonna copy/paste it into my code db... Thanx, GL!)

--ST

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.