Posted By

alces on 02/08/13


Tagged

hack html option tag selected MarkupBuilder


Versions (?)

MarkupBuilder HMTL tag


 / Published in: Groovy
 

URL: groovy_markup_builder_option_selected

Little hack for correct-working tag in groovy.xml.MarkupBuilder Tested in Firefox 10.0, Opera 12.13, Chromium 22.0

  1. VAL = 5
  2.  
  3. html.html {
  4. body {
  5. form {
  6. select(name: 'pick') {
  7. for (i in 1..10) {
  8. if (i == VAL) {
  9. option(selected: 1, i)
  10. } else {
  11. option i
  12. }
  13. }
  14. }
  15. }
  16. }

Report this snippet  

You need to login to post a comment.