Yes, I was thinking this was javascript code. Sorry I missed that, it's been a long day...
On Tue, Jan 29, 2013 at 7:59 PM, Lamps902 <[email protected]> wrote: > It looks like you might be sort of conflating javascript and python code > there. Before you do anything with javascript, modify the checkbox element > in the [controller_name].py file, as I described above. For example, if you > used SQLFORM() to generate your form from a database table, in your > controller, you should have something like: > > form = SQLFORM( ... ) > form.elements('input',_id='rebates_tiered')[0]['_type'] = 'button' > > This will turn the checkbox with the id "rebates_tiered" into a button. > Then, whatever functionality you need from javascript, if any, is > implemented in the appropriate view (html) file. > > > On Tuesday, January 29, 2013 8:16:04 PM UTC-5, Jim S wrote: >> >> Please forgive me for not knowing this, but here is what I tried: >> >> $('.web2py_form').elements('**input',_id='rebates_tiered')[**0]['_type'] >> = 'button'; >> >> But, I get: >> >> TypeError: $(...).elements is not a function >> >> Any clues on what I'm specifying incorrectly? >> >> -Jim >> >> On Tuesday, January 29, 2013 2:14:51 PM UTC-6, Jim S wrote: >>> >>> Nope, but will now! >>> >>> Thanks >>> >>> -Jim >>> >>> On Tue, Jan 29 >>> >>>> Just tried the code I posted above with IE 9, and it did change the >>>> checkbox to a button. Did you give it a shot? >>>> >>>> >>>> >>>> On Tuesday, January 29, 2013 2:00:45 PM UTC-5, Jim S wrote: >>>>> >>>>> The research I've done is telling me that IE won't allow you to change >>>>> the type of an element. Therefore, I need to generate it as a >>>>> type="button" from the start. The bootstrap example also shows this as a >>>>> <button> element and not an <input>. Not sure if that is relevant though. >>>>> >>>>> -Jim >>>>> >>>>> On Tuesday, January 29, 2013 12:53:50 PM UTC-6, Lamps902 wrote: >>>>>> >>>>>> Hi, Jim. What about doing the following: >>>>>> >>>>>> form.elements('input',_id='**che**ckbox_field_n')[0]['_type'] = >>>>>>> 'button' >>>>>>> >>>>>> >>>>>> I imagine the value can then be toggled with, for example, >>>>>> javascript's 'onclick' functionality, and stored in the db as usual. >>>>>> >>>>>> On Tuesday, January 29, 2013 11:46:55 AM UTC-5, Jim S wrote: >>>>>>> >>>>>>> I have a form that is going to hold a number of boolean fields. I >>>>>>> want to change them to buttons instead of checkboxes so I can use the >>>>>>> bootstrap button widgets. How can I chance the boolean widget from a >>>>>>> checkbox to a button and have the value properly put back into the >>>>>>> database? >>>>>> >>>>>> -- >>>> >>>> --- >>>> >>>> >>>> >>> >>> -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

