Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Twitter Bootstrap, simple_form, replace checkbox with button.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
prodigerati  
View profile  
 More options Apr 15 2012, 1:04 am
From: prodigerati <freeman.ja...@gmail.com>
Date: Sat, 14 Apr 2012 22:04:57 -0700 (PDT)
Local: Sun, Apr 15 2012 1:04 am
Subject: Twitter Bootstrap, simple_form, replace checkbox with button.

I am using Simple_form, twitter bootstrap, and rails 3.2.2

Does anyone know if there is a way to use the "toggle button" option for
bootstrap on boolean fields in a simple_form? I would like to replace the
checkboxes with buttons.

Here is what I've tried so far with no luck in the form (rails):

<%= f.input :client_approved, :input_html => { :class => 'btn btn-primary', :data => {:toggle => 'button'} } %>

Here is the HTML output:

<input class="boolean optional btn btn-primary" data-toggle="button" id="id_card_design_client_approved" name="id_card_design[client_approved]" type="checkbox" value="1">

Any ideas on how to assign a button tag to the simple_form input?

Here is an example from the twitter bootstrap website for the toggle button
tag:

<button class="btn" data-toggle="button">Single Toggle</button>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Antonio da Silva  
View profile  
 More options Apr 15 2012, 5:19 pm
From: Carlos Antonio da Silva <carlosantoniodasi...@gmail.com>
Date: Sun, 15 Apr 2012 18:19:53 -0300
Local: Sun, Apr 15 2012 5:19 pm
Subject: Re: Twitter Bootstrap, simple_form, replace checkbox with button.

How does a "toggle button" relies to "an input field"? I see you're generating an input field but wants a button?

Perhaps I didn't get what you're trying to accomplish.

--
At.
Carlos Antonio


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
prodigerati  
View profile  
 More options Apr 16 2012, 10:38 am
From: prodigerati <freeman.ja...@gmail.com>
Date: Mon, 16 Apr 2012 07:38:09 -0700 (PDT)
Local: Mon, Apr 16 2012 10:38 am
Subject: Re: Twitter Bootstrap, simple_form, replace checkbox with button.

Hi Carlos,

I would like to replace checkboxes with buttons. If toggled then true,
otherwise false.

Thanks,

Javid

On Sunday, April 15, 2012 2:19:53 PM UTC-7, Carlos Antonio da Silva wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Antonio da Silva  
View profile  
 More options Apr 21 2012, 5:47 pm
From: Carlos Antonio da Silva <carlosantoniodasi...@gmail.com>
Date: Sat, 21 Apr 2012 18:47:44 -0300
Local: Sat, Apr 21 2012 5:47 pm
Subject: Re: Twitter Bootstrap, simple_form, replace checkbox with button.

I believe I get what you want, it's something like that right? http://twitter.github.com/bootstrap/javascript.html#buttons

But buttons don't give you the state required to send to the server, they're completely different than checkboxes, unless you add some javascript and a hidden field on top of that.

Anyway, it's not possible to create a collection of buttons using SimpleForm, mainly because they're not actually related to an attribute. It's up to you to generate and handle them.

--
At.
Carlos Antonio


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »