jade question about radio button options

5,095 views
Skip to first unread message

C. Mundi

unread,
Jan 29, 2012, 6:20:34 PM1/29/12
to expre...@googlegroups.com
I figure this is where the Jade gurus are...

Can someone tell me why

input(type='radio', name='thing', value='1') Thing 1 <br>
input(type='radio', name='thing', value='2') Thing 2 <br>
input(type='radio', name='thing', value='3') Thing 3 <br>

renders a horizontal row of three radio buttons with no labels, but

input(type='radio', name='thing', value='1')
Thing 1 <br>
input(type='radio', name='thing', value='2')
Thing 2 <br>
input(type='radio', name='thing', value='3')
Thing 3 <br>

renders a vertical column of three radio buttons with labels as expected?

Obviously, I expect both snippets to render the same way.  The second example is what I am using.  Why does the first example not work the same way?

Baffled...

Thanks


Prashanth

unread,
Jan 29, 2012, 10:02:38 PM1/29/12
to expre...@googlegroups.com
On Mon, Jan 30, 2012 at 4:50 AM, C. Mundi <cmu...@gmail.com> wrote:
>
> Obviously, I expect both snippets to render the same way.  The second
> example is what I am using.  Why does the first example not work the same
> way?
>
> Baffled...
>


First you are suppose to use a label and css to style it. I am not
sure which doctype you are using, using <br> is a old school/
non-standard way. You might wrap option and label in a block element
like p tag or style them.
http://www.webdesignfromscratch.com/html-css/css-block-and-inline/

--
regards,
Prashanth
twitter: munichlinux
irc: munichlinux, JSLint, munichpython.

C. Mundi

unread,
Jan 29, 2012, 11:19:10 PM1/29/12
to expre...@googlegroups.com

Sure.  No question, you're right about styling. 

But I'm asking about the behavior of the jade compiler, old school or not.

--
You received this message because you are subscribed to the Google Groups "Express" group.
To post to this group, send email to expre...@googlegroups.com.
To unsubscribe from this group, send email to express-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/express-js?hl=en.

Kevin Sakhuja

unread,
May 5, 2012, 2:37:04 PM5/5/12
to expre...@googlegroups.com
Do this.

input(type='radio', name='thing', value='1') 
   | Thing 1 
br
input(type='radio', name='thing2', value='2') 
   | Thing 2 
br

To unsubscribe from this group, send email to express-js+unsubscribe@googlegroups.com.

Marcelo Tosco

unread,
May 21, 2012, 3:12:46 PM5/21/12
to expre...@googlegroups.com
Dont know the reason, but if the label starts with an uppercase letter sometimes fail. Use "|" as prefix to solve the problem:

div.control-group
  label.control-label Género
  div.controls
      label.radio.inline
          input(type="radio", name="optionsRadios", id="optionsRadios1", value="option1", checked="")
          |Male

      label.radio.inline
          input(type="radio", name="optionsRadios", id="optionsRadios2", value="option2")
          |Female

Marcelo Tosco

unread,
May 21, 2012, 3:13:48 PM5/21/12
to expre...@googlegroups.com
Dont know the reason, but if the label starts with an uppercase letter sometimes fail. Use "|" as preffix to solve the problem:

Emlyn A

unread,
Sep 18, 2015, 1:23:24 PM9/18/15
to Express
It's 3 years on and apparently Jade is still choking on basic HTML markup? Uhh...

I'm encountering "undefined" errors caused by radio elements. None of the workarounds here have solved it. Am I missing something?

Emlyn A

unread,
Sep 18, 2015, 1:23:25 PM9/18/15
to Express
Never mind: the issue is NOT TO INDENT the line beginning "| blah"

Seriously, it's about time Jade had proper error reporting; "undefined" doesn't cut it. #OneHourWasted


On Monday, May 21, 2012 at 3:13:48 PM UTC-4, Marcelo Tosco wrote:

Nathan White

unread,
Sep 18, 2015, 2:48:02 PM9/18/15
to expre...@googlegroups.com

1. You could always submit a PR.
2. The defaults for view engines in express are not always ideal. Sometimes I customize the app.engine for jade to turn the debug flag on.
3. You could always add the the debug flag in your render call
4. You can always catch the error from res.render.

res.render('template', {}, function(err, html){
   // handle and inspect error
   res.send(html);
});
--
You received this message because you are subscribed to the Google Groups "Express" group.
To unsubscribe from this group and stop receiving emails from it, send an email to express-js+...@googlegroups.com.

To post to this group, send email to expre...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages