1971 Posts in 1275 Topics by 607 members
|Go to End|
11 May 2011 at 12:54pm
My apologies if this is asked elsewhere -- I tried searching the forums but only got threads relating to the old AutocompleteField.
I want to append autocomplete="off" to one (or more) of my TextField()s but currently I have no idea how to do it and can't find any way to add arbituary attributes to any of the Form fields. Any tips?
Thanks a million!
Nathan J. Brauer
P.S. I'm new to SS/Saphire but I'm becoming a fan very quickly. Hopefully the community is as great as the framework
12 May 2011 at 2:04pm
Sadly there is nothing in the FormField API for appending attributes. If you look at TextField::Field() you can see how tags are 'created' the form fields are currently still generated from the PHP for performance reasons.
13 May 2011 at 2:03am
Is there a way I can make the changes necessary to append attributes and submit them to be included in the official project?
13 May 2011 at 1:52pm
Sure! If you plan on contributing it back to core follow the instructions on http://doc.silverstripe.org/sapphire/en/misc/contributing. You will need to fork the sapphire git repo so you can submit the changes easily.
In terms of what you need to change, I guess you need a couple functions for adding / removing / setting attributes and a map of attributes stored on each FormField (to replace the current hardcoded arrays)
Unit tests for this to be included in core is a must
14 May 2011 at 5:04am
Sounds good. I'll see if I can squeeze it into my weekend
20 April 2014 at 3:22am
FYI - to those searching via Google.
You can now do this using the ->setAttribute method.
|Go to Top|