jsRoutes.controllers.Control.toggle($(this).prop('id'),$(this).prop('checked')?1:0).ajax({});
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/n_5KarfUo6UJ.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
You should be able to use JavaScript booleans and the JavaScript reverse router will encode them to 0/1.
On 29 juin 2012, at 18:14, Richard Searle wrote:
This is inconvenient since Javascript will convert boolean to true/false.--jsRoutes.controllers.Control.toggle($(this).prop('id'),$(this).prop('checked')?1:0).ajax({});Note the ternary operator to map to 0/1.This clutters the code and leads to silent failures when it is omitted.
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/n_5KarfUo6UJ.
To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.
_nS('controllers.Control'); _root.controllers.Control.toggle =
function(name,checked) {
return _wA({method:"POST", url:"/control/toggle/" + (function(k,v) {return v})("name", name) + "/" + (function(k,v) {return v})("checked", checked)})
}Which does not contain any boolean to 0/1 mapping.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/AA-AxmlmjeIJ.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
Maybe we could accept both 0/1 and false/true as valid boolean
parameters and produce false/true with the reverse router. I think it
wouldn’t break anything. What do you guys think?
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/uiTFbRnAot4J.