You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used hiccup to generate a checkbox. I want to check it and/or disable it under certain conditions. The HTML should emit with the word checked or disabled but is putting out checked="true" or disable="false". The browser sees the work checked and disabled and always checks and disables the control regardless of its value.
I looked at how Hiccup does this. It looks like for a value with a true it renders the attribute name and for a value of false it renders nothing so {:disabled true} comes out as disabled as it should.
Here is the code:
(defn-render-attribute [[name value]]
(cond
(true? value)
(if (xml-mode?)
(xml-attribute name name)
(str"" (as-str name)))
(not value)
"":else
(xml-attribute name value)))
I think Enfocus just flattens the map so you get something like disabled="true" instead of just disabled.
I used hiccup to generate a checkbox. I want to check it and/or disable it under certain conditions. The HTML should emit with the word checked or disabled but is putting out checked="true" or disable="false". The browser sees the work checked and disabled and always checks and disables the control regardless of its value.
This is the function.
The text was updated successfully, but these errors were encountered: