i trying change value in db controlled via checkbox, if review item exist populating fields . have hidden field , jquery mobile checkbox controlling this:
models.py:
fave = models.booleanfield()
modelforms face class:
'fave': hiddeninput(attrs={'value' : 'false'}),
and review form:
{% if review.fave == 'true' %} <div class="ui-block-c"> <input type="checkbox" name="fave" id="checkbox-1" class="custom" checked="checked"/> <label for="checkbox-1">fave</label> </div> {% else %} <div class="ui-block-c"> <input type="checkbox" name="fave" id="checkbox-1" class="custom" /> <label for="checkbox-1">fave</label> </div> {% endif %}
the hidden field rendered browser such:
<input type="hidden" name="fave" value="true" id="id_fave">
while make checkbox non-hidden field, task make fit way supposed django , jquery mobile looks daunting.
several posts listed solutions: setting value of hidden input
, nothing seems work way want. cannot seem override value = true
.
is there simple missing? going wrong?
try using
'fave': checkboxinput(attrs={'style':'display:none'})
Comments
Post a Comment