Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-standard attributes in <form> tags [SPR-5931] #10600

Closed
spring-projects-issues opened this issue Jul 15, 2009 · 4 comments
Closed

Allow non-standard attributes in <form> tags [SPR-5931] #10600

spring-projects-issues opened this issue Jul 15, 2009 · 4 comments
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 15, 2009

Matthew Sgarlata opened SPR-5931 and commented

The dojo framework creates form widgets using a syntax like this

  <select	dojoType="dijit.form.FilteringSelect"
id="setvaluetest2"
name="state1"
autoComplete="false"
invalidMessage="Invalid state name"
onChange="dojo.byId('oc1').value=arguments[0]"

As far as I can tell, it's impossible to do stuff like this with the Spring <form> tags because there is no way to specify non-standard HTML attributes. An approach I've used for my own custom tags is to add a catch-all attribute called "attributes" so the syntax would look something like

<form:select id="setvaluetest2" attributes='dojoType="dijit.form.FilteringSelect" invalidMessage="Invalid state name" ... etc


Attachments:

Issue Links:

Referenced from: commits 982ece5

1 votes, 3 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues
Copy link
Collaborator Author

Tim commented

Attaching a proposed patch. If someone is inclined to look at this. A few notes on the patch:

  1. Of course, a comitter needs to review and agree on where/how/what the patch implements.

Summary: It adds a lazily instantiated map to AbstractFormTag as well as default implementation of setDynamicAttribute from the DynamicAttribute interface. It does not declare AbstractFormTag as an implementor of DynamicAttribute (just gives a default impl of the method for convenience.) Next, AbstractHtmlElementTag added call writeDynamicAttributes akin to writeOptionalAttributes. Finally, declare AbstractHtmlInputElementTag to implement DynamicAttributes (marker interface for containers to accept/support DynamicAttributes and the assumption is that this is the base class we want to support dynamic attributes on?)

  1. I'm not familiar with Ivy or the build process. I know maven so... mvn clean compile executes successfully (after a few pom tweaks on my end like changing javax.activation dependency to geronimo-spec version of it etc..Just my preference to get the build running) but...

  2. mvn clean install fails with a couple of test compilation failures unrelated to the patch it seems. Not sure if these are supposed to work or if maven is really used, etc. But without being able to compile the test suite I've tried to emphasize "draft". So hopefully someone finds this a useful start.

@spring-projects-issues
Copy link
Collaborator Author

Keith Donald commented

Assigned to Jeremy for completion for upcoming 3.0.0.RC1.

@spring-projects-issues
Copy link
Collaborator Author

Jeremy Grelle commented

Taking advantage of the dynamic attributes feature will require upgrading the tag library to JSP 2.0.

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0 RC1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant