Open rqcashman opened 6 years ago
Here is an image of the page when it is working.
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.