Jump to content

Adding data- attributes (with no value) to form doesn't work


awesomolocity
 Share

Recommended Posts

Okay, so I'm making some modifications to Ryan's LoginRegister module. Currently, I'm attempting to add a couple html attributes to the form. (Specifically "data-abide" - see Zurb Foundation).

On line 515 of LoginRegister.module, I saw

$form->attr('id', 'LoginRegisterForm');

 so I attempted doing the same thing with my attribute, but it didn't work.

$form->attr('data-abide', '');

Upon searching, it looks like the cause of the removal of attributes with no values is the getAttributesString() function in wire/core/inputfield.php, specifically line 1135

// skip over empty attributes
if(!is_array($value) && !strlen("$value") && (!$value = $this->attr($attr))) continue;

 

 

Now, I realize that I could just comment out that line and it works perfectly fine if I do. However, that doesn't really seem ideal since it'll break on updates. My question is: how should I go about doing this? Just comment out the line and hope Ryan removes it in the future? Or another way I hadn't thought of?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...