2

I'm wanting to add a new parameter (data-validate="parsley") to the Safecracker form tag. I know this isn't possible out of the box but was wondering whether it was possible to write a simple(ish) extension that could do it?

If anyone can give me some pointers, I'm willing to have a go.

Cheers

Jim

1
  • I need an answer on this one too, so chiming in so I get updates if someone has a solution. Aug 21, 2013 at 10:50

1 Answer 1

6

I've created an extension that'll let you do it.
https://github.com/jazonv/SafeCracker-HTML5-Attributes

In addition to data-foo="bar", it'll also lets you use autocomplete="no" and novalidate="novalidate".

(Inspired by this gist by Objective HTML)

Disclaimer:
I'm by no means a PHP/Add-on dev. I just wanted to 'have a go' too. Hopefully there's nothing wrong with it.
If any better-versed devs want to give it a once over, that'd be appreciated.

3
  • Thanks so much for this Jason. I had no idea that Justin Kimbrell had already done something similar that you were able to adapt. I've tested the extension now and can confirm that it works! Aug 26, 2013 at 9:45
  • Open source at it's finest folks. Again, nice work on this Jason. Aug 26, 2013 at 14:19
  • No worries, glad to help. Aug 27, 2013 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.