Adding attributes to cq5 form using FormsHelper

459 Views Asked by At

I'm trying to add an attribute to the form tag of a cq5 form. I noticed that the output is generated using

FormsHelper.startForm(slingRequest, new JspSlingHttpServletResponseWrapper(pageContext));

I was curious how I can either:

  1. alter the request so that the formHelper prints the form w/ the attributes I need
  2. Hook into the actual print out to include the attributes I need.

Any help or direction would be good.

note: I've already checkout out the javadoc for formshelper, done some searching via goolgle, and dev.day.com including the dev.day.com doc on developing forms.

thank you

1

There are 1 best solutions below

0
On

API doesn't allow you to add any attributes to this tag. You can only specify desired CSS classes adding css property to the form component. Of course, you can also create component sling filter and response wrapper to rewrite created form, but it seems to be an overkill. I think better solution is using JS to add attributes client-side.