Vy Do
Vy Do

Reputation: 52646

How to add new attribute to Struts 1 <s:form>?

This is document from Zurb abide validation tool: http://foundation.zurb.com/docs/components/abide.html#setting-up-validation

I use Struts 1 form, and try something like this:

<s:form styleId="frmAddEstate" action="${addEstateProfile}" data-abide>
    // input fields...
</s:form>

but not working. Please help me put "data-abide" to form tag. (I think we will revise file *.tld - tag lib definition).

Upvotes: 1

Views: 588

Answers (1)

Roman C
Roman C

Reputation: 1

You can use javascript to add attributes to the form when it has been loaded.

document.getElementById("frmAddEstate").onload = function() {myFunction()};

function myFunction() {
  var att = document.createAttribute("data-abide");
  document.getElementById("frmAddEstate").setAttributeNode(att);
}

Upvotes: 1

Related Questions