1

I have an input field to enter datetime. I have set its attribute readonly to restrict manual input (as the user might enter date in different format.)

Next, I'm using parsely.js for the form validation. I have added the data-parsley-required attribute to the input field but the required validation doesn't work for this readonly input field.

If I remove the readonly and let only the required attribute stay there, then it works.

How can I circumvent this issue?

Shikasta_Kashti
  • 701
  • 2
  • 13
  • 28
  • Not clear to me what you're asking. Codepen? – Marc-André Lafortune Jan 12 '16 at 22:57
  • @Marc: http://codepen.io/anon/pen/jWLLbJ – Shikasta_Kashti Jan 13 '16 at 17:51
  • The problem is that I have an input field which I need to keep `readonly` and also want it to be a `required` field. So I have both `readonly` and `required` attributes on the `` tag. But when I do so the `required` doesn't work. – Shikasta_Kashti Jan 13 '16 at 17:54
  • Surprisingly, this problem doesn't appear in the codepen. I also tried same thing with jsfiddle and it works properly there too. It is only when I try it locally or from the hosted website that this happens. – Shikasta_Kashti Jan 13 '16 at 17:55
  • Maybe there is an error with the markup on your local instance that is corrected in codepen? Try html-tidy. – J E Carter II Jan 13 '16 at 18:25
  • @J E Carter: Can required and readonly attributes both work simultaneously? http://stackoverflow.com/questions/12777751/html-required-readonly-input-in-form – Shikasta_Kashti Jan 13 '16 at 19:06

0 Answers0