[
https://issues.apache.org/jira/browse/TAPESTRY-772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Andreou updated TAPESTRY-772:
-------------------------------------
Fix Version/s: (was: 4.1.4)
4.1.5
> Valiadator needs to support "depend on" like Struts (i.e. field D is
> mandaatory ONLY depending on the setting of field B)
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: TAPESTRY-772
> URL: https://issues.apache.org/jira/browse/TAPESTRY-772
> Project: Tapestry
> Issue Type: Wish
> Components: Framework
> Affects Versions: 3.0.5
> Environment: Any
> Reporter: Tony Herstell
> Assignee: Andreas Andreou
> Fix For: 4.1.5
>
>
> The Validation Framework lets you set a field as Mandatory.
> Setting clientScriptEnabled to true in the .page turns on javascript support.
> Both GREAT features.
> I wish to have the ability, before Tapestry 4 is released to have this field
> be mandatory, but ONLY when another field is selected. (The Struts Validator
> plugin is a good example of this and uses a "valid-when" property - refer to
> Struts Validator (not actually part of Struts however) documentation for a
> complete overview and some useful "design" concepts you could leverage).
> Worked Explanation:
> ================
> I have a form, that has a check box.
> I have fields on the form that are hidden (or disabled!) depending on this
> check box. I use Javascript to manipulate the DOM to hide these fields
>
> document.getElementById("SomeIDIHaveToManauallyAddToTheHTMLElement").style['display']="none")
> Since the fields are declared mandatory in the .page, then when the user
> presses "Submit" on the form the current implementation of the javascript
> notices that the mandatory field is not empty and attempts to move the cursor
> to it... this fails as the field is either hidden or disabled, and the form
> gets submitted anyhow (a useful side effect - turn on javascript errors to
> see it happen)!!!
> At Server side, the validation is checked again and the field is again found
> to be in error so you have to catch the errors and ignore them:
> if (delegate.getHasErrors()) {
> // return; <------- Ignore them!!! or catch the ones you want
> }
> Soultion
> =======
> The javascript (and back end validation) should check the pre-conditions
> (i.e. ValidWhen Rules), set up in the component declaration in the .page
> before treating it as mandatory!!!
> Poor Workaround
> ===============
> 1. This allows you to get round the problem, but you must have the hidden
> field at the end of the form as it "auto-submits" the form when the
> javascript encounters the first field it cannot write to... (Well on IE
> anyhow).
> 2. Dont hide/disable any mandatory fields in a Form using tapestry... (makes
> the screens full of fields that the user should not see let alone be able to
> type into).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]