History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: BPM-300
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Wouter Zoons
Reporter: Jean-Marc Collin
Votes: (View)
Watchers: (View)
Operations

If you were logged in you would be able to see more operations.
Bpm4Struts Cartridge

Date struts validator failed when a datefield is displayed as a textfield

Created: 13/Nov/07 11:29 PM   Updated: 15/Nov/07 10:03 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. XML File validator-rules.xml (30 kb)

Environment: For version 3.3-SNAPSHOT


 Description   
The issue is the following :
When having a date attribute displayed as a Textfield, the Javascript generated by Andromda (or perhaps by Struts validator) try to verify this field.
Because this field doesn't exist (only a label is displayed and not an Html input), the Javascript validator fails and no validation are done.
I didn't find any workaround to make date field displayed as textfield not being verified.

 All   Comments   Change History      Sort Order:
Comment by Jean-Marc Collin [13/Nov/07 11:34 PM]
Here is a workaround.
I've modified validator-rules.xml, not to verify field that are null (or 'undefined' is Javascript).
I add comments around the modifications (just add 'if (field != null)' test around field manipulation.

This workaround is successfully tested with Firefox (and not with IE).

The correct solution would be to not generate date verification for date field displayed as textfield.


Comment by Jean-Marc Collin [13/Nov/07 11:37 PM]
Same issue can be reproduce by specifying as readonly an attribute displayed as textfield.
So the correct correction should be to not generate any JS validation on textfield attribute (and not only for date as explained above).

Comment by Wouter Zoons [13/Nov/07 11:52 PM]
I never actually intended dates to be represented using plain text fields but I guess we should allow it nevertheless .. according to you, which types do not require validation when rendered into a textfield (you mentioned 'not only date a explained above' ) ?
I am just reading all this for the first time but could you explain to me why you talk about a text field while at the same time you say the field does not exist ?

Comment by Jean-Marc Collin [13/Nov/07 11:58 PM]
OK my text was not clear ...
In my 2 lasts comment, I wanted to say "plaintext" instead of "textfield".

So with this replacement, we've got :
"... The correct solution would be to not generate date verification for date field displayed as plaintext" for the 1rst comment,

and
"Same issue can be reproduce by specifying as readonly an attribute displayed as plaintext.
So the correct correction should be to not generate any JS validation on plaintext attribute (and not only for date as explained above)." for the second comment.

Sorry for this mistake.

Comment by Wouter Zoons [14/Nov/07 01:57 PM]
so if I understand correctly (I haven't tried to reproduce it yet), it would be sufficient to added the conditional statement around the part where the plaintext would be generated ? should not be a problem..

Comment by Jean-Marc Collin [15/Nov/07 10:03 PM]
I'm not shure I'm understand correctly your proposition, but to my opinion the best way is to do the following :
- struts validator should not try to verify plaintext field (@andromda.presentation.web.view.field.type=plaintext). The best way to do this is certainly to not generate plaintext field in the "WEB-INF/validator.xml" file.

If this is not simple, the other solution, is to add conditional statement around the javascript generated code. This is done by modifying the validator-rules.xml file like done in the one I upload. Of course the first solution is the best.