[Seaside] [Bootstrap] Hidden input messing with checkbox

Cyril Ferlicot D. cyril.ferlicot at gmail.com
Fri Nov 4 09:07:29 UTC 2016


On 04/11/2016 04:47, Mariano Martinez Peck wrote:
> Hi Cyril,
> 
> It would be nice if you can paste your seaside render code besides the
> resulting html.
> 
> Cheers,
> 


Hi!

This is the code I used:

self orderedAnswers
  do: [ :answer |
    html div
    class: #checkbox;
    with: [ html checkbox
      id: html nextId;
      value: (aComponent resultFor: answer);
      callback: [ :isChecked | aComponent at: answer put: isChecked ].
      html label
      for: html lastId;
      with: answer text ] ]

And this is the result:

<div class="checkbox">
  <input id="id35" name="36" type="checkbox">
  <input name="37" type="hidden">
  <label for="id35"> rutrum feugiat</label>
</div>


Yesterday I found a hack to make it work but I would like something cleaner:

html document addLoadScript: (JSStream on:
'$(".checkbox").each(function(i,e){$(e).children("input[type=hidden]").prependTo(e)})')

One problem with that is that I need to think to call it when I use Ajax.

-- 
Cyril Ferlicot

http://www.synectique.eu

2 rue Jacques Prévert 01,
59650 Villeneuve d'ascq France

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20161104/4ff09578/attachment.sig>


More information about the seaside mailing list