formfield readonly ?

This topic contains 1 reply, has 2 voices, and was last updated by  Sebastian 4 years, 2 months ago.

Author Posts

johannesodeg

Can I make a formfield readonly using microthemer?

– Johannes


Sebastian

Hey Johannes,

To make a form field read only, you need to add the readyonly attribute to the HTML element rather than doing anything in Microthemer. The following article explains this: https://www.w3schools.com/tags/att_input_readonly.asp

Once you’ve set your form field as readonly, you can style it differently from the other read & write fields with Microthemer by enabling the :read-only pseudo selector when targeting the element:

Using the :read-only pseudo selector

Note: I’ve just noticed that Microthemer requires the readonly attribute to be added with the following syntax:

readonly="readonly"

(rather than just readonly by itself)

This will be fixed in the next day or two. I’ve already updated my development version of Microthemer, but I need to finish some other updates I’m half way through before rolling out an update. I hope that’s OK.

Finally, you can dynamically change whether nor not form elements are readonly with JavaScript: https://www.w3schools.com/jsref/prop_text_readonly.asp

If you want to go down this route, you can add some custom JavaScript via Microthemer’s JS editor – View > Code editor (the last tab on the right).

I hope that helps. Please let me know if you have any further questions.

Thanks!
Sebastian

You must login or register to reply to this topic.