Hello,

After looking carefully at form.js and core.js. There are problems with the skeleton concerning form validation :

- There is no way to override or intercept a form submit event if the form is submitted asynchronously, same for refresh or cancel .... this is very much needed if you want to a function to be notified when one of this event happens WETHER by tapestry.form.onsubmit("myForm", myFunction) OR tapestry.connect("myForm", "onsubmit", myFunction)

- There is no standard way to append a validation message to the stack of validation messages created from the form profile. One should be able to call tapestry.invalid_field('The field blah is invalid') And this should be appended to normal validation

- Validation profiles are rather not clear, complicated and considered as instable in the dojo tree, all the validation should not depend only on this mechanism...

- tapestry.connect assumes you connect a function in the tapestry namespace !? that's wrong, it should be : For 3 args : search for the function in the tapestry namespace and global namespace
  For 4 args : search for the function in the given namespace

- validation using tapestry should not impose its method to show JS validation messages... Actually it is a a dialog widget from dojo. But it should be made simple to override that with your own presentation function :
 ex: tapestry.form.summarizeErrors(form, messages)

Numa

===============================
Numa Schmeder

Skype       numito
MSN/AIM nschmeder
Email        [EMAIL PROTECTED]
===============================

Le 28 févr. 08 à 00:32, Andreas Andreou (JIRA) a écrit :


[ https://issues.apache.org/jira/browse/TAPESTRY-2139? page=com.atlassian.jira.plugin.system.issuetabpanels:comment- tabpanel&focusedCommentId=12573102#action_12573102 ]

Andreas Andreou commented on TAPESTRY-2139:
-------------------------------------------

Can you attach a diff file with all your changes?

Using ValidField and Validator triggers null point exception
------------------------------------------------------------

                Key: TAPESTRY-2139
URL: https://issues.apache.org/jira/browse/ TAPESTRY-2139
            Project: Tapestry
         Issue Type: Bug
         Components: Framework
   Affects Versions: 4.1
        Environment: Macos X, java 1.4
           Reporter: Numa Schmeder

Hello,
There is a small bug:
Description:
Using deprecated component ValidField, a validation bean (IValidator), and enable javascript for this validator, then there is a null pointer exception.
java.lang.NullPointerException
Stack Trace:
org.apache.tapestry.valid.BaseValidator.processValidatorScript (BaseValidator.java:292) org.apache.tapestry.valid.StringValidator.renderValidatorContribution (StringValidator.java:109)
Test-Case:
--html--
<form jwcid="@Form" delegate="bean:delegate" clientValidationEnabled="ognl:true"> <input jwcid="@ValidField" type="text" value="ognl:count" validator="bean:requiredString" displayName="testField"/>
                <input type="submit" value="Enregistrer"/>
        </form>
--spec--
<bean name="requiredString" class="org.apache.tapestry.valid.StringValidator,required,minimumLeng th=10,clientScriptingEnabled">
    </bean>
--java--
        public String getMyName() {
                System.out.println("get my name " );
                return "Numa";
        }
        
        public abstract int getCount();
        public abstract void setCount(int count);
Tested Solution:
Add the following lines to ValidField.java on line 90 in the method renderComponent //Add on 4.1, SetScriptSource was added in 4.1 but is never called, so _scriptSource was never initialized validator.setScriptSource(cycle.getInfrastructure ().getScriptSource()); //In case ClientValidationEnabled is set to the form set it also to the Validator if (getForm().isClientValidationEnabled() && validator instanceof BaseValidator)
                        
((BaseValidator)validator).setClientScriptingEnabled(true);
I know the component is deprecated, but still in my case I want to migrate from 4.0 to 4.1 and I have more then 50 pages using forms with ValidField, I don't to change all of them, but I would like to take
the advantage of 4.1 for other pages...
Regards,
Numa

--
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]

Reply via email to