You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org> on 2010/09/07 11:50:33 UTC

[jira] Created: (TRINIDAD-1906) Client Validation igonred with tag

Client Validation igonred with <f:ajax> tag
-------------------------------------------

                 Key: TRINIDAD-1906
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1906
             Project: MyFaces Trinidad
          Issue Type: Bug
    Affects Versions: 2.0.0.3-core
            Reporter: Matthias Weßendorf


Have a form like:

...
    <tr:form....>
      <tr:panelFormLayout>

        <tr:inputText id="ajax" label="Field 1:">
          <f:ajax event="change" />
        </tr:inputText>
        <tr:inputText id="ppr" label="Field 2:" required="true">
        </tr:inputText>
      </tr:panelFormLayout>
    </tr:form>
...


Go to field1, type and TAB out:
=> An ajax request is queued and send down to the server

In Trinidad (with autosubmit, instead of f:ajax) you'd see a warning that "Field 2" is required

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1906) Client Validation igonred with tag

Posted by "Andrew Robinson (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906913#action_12906913 ] 

Andrew Robinson commented on TRINIDAD-1906:
-------------------------------------------

Note that I sent a question/bug to the RI team that the onEvent should be documented on how it handles JS errors. If this were "allowed", we could simply perform client side validation during the begin event of the JSF ajax request and if validation fails, throw an error. 

The problem with this approach, is that this assumes that the user wants client side validation to be run before a JSF ajax request. Because JSF ajax requests do not have to be form submissions, and may only be JSF based ajax "get" requests, the developer may want to still go back to the server if there is invalid data (to look up valid values to show the user for example). Forcing client validation to be run for all JSF ajax requests could be viewed as a severe blocking bug if the user wanted to do so.

> Client Validation igonred with <f:ajax> tag
> -------------------------------------------
>
>                 Key: TRINIDAD-1906
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1906
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 2.0.0.3-core
>            Reporter: Matthias Weßendorf
>
> Have a form like:
> ...
>     <tr:form....>
>       <tr:panelFormLayout>
>         <tr:inputText id="ajax" label="Field 1:">
>           <f:ajax event="change" />
>         </tr:inputText>
>         <tr:inputText id="ppr" label="Field 2:" required="true">
>         </tr:inputText>
>       </tr:panelFormLayout>
>     </tr:form>
> ...
> Go to field1, type and TAB out:
> => An ajax request is queued and send down to the server
> In Trinidad (with autosubmit, instead of f:ajax) you'd see a warning that "Field 2" is required

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1906) Client Validation igonred with tag

Posted by "Werner Punz (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906922#action_12906922 ] 

Werner Punz commented on TRINIDAD-1906:
---------------------------------------

Actually from my knowledge the best bet on what is going into 2.1 is to check the bugtracker.
There already is some stuff postponed for 2.2 due to the tight schedule they have for 2.1.
So the originally planned 2.1 probably will be 2-3 subsequent releases given the new schedule they have.
My fileupload stuff for instance already was postponed to 2.2 because they would not make it in time anymore for mojarra.


> Client Validation igonred with <f:ajax> tag
> -------------------------------------------
>
>                 Key: TRINIDAD-1906
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1906
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 2.0.0.3-core
>            Reporter: Matthias Weßendorf
>
> Have a form like:
> ...
>     <tr:form....>
>       <tr:panelFormLayout>
>         <tr:inputText id="ajax" label="Field 1:">
>           <f:ajax event="change" />
>         </tr:inputText>
>         <tr:inputText id="ppr" label="Field 2:" required="true">
>         </tr:inputText>
>       </tr:panelFormLayout>
>     </tr:form>
> ...
> Go to field1, type and TAB out:
> => An ajax request is queued and send down to the server
> In Trinidad (with autosubmit, instead of f:ajax) you'd see a warning that "Field 2" is required

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1906) Client Validation igonred with tag

Posted by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906724#action_12906724 ] 

Matthias Weßendorf commented on TRINIDAD-1906:
----------------------------------------------

One solution could be to have a custom taghandler for f:ajax, which hooks up the correct Trinidad logic.

However the same issue would be still present, if page authors call directly jsf.ajax.request(); (or 3rd party libraries)

> Client Validation igonred with <f:ajax> tag
> -------------------------------------------
>
>                 Key: TRINIDAD-1906
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1906
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 2.0.0.3-core
>            Reporter: Matthias Weßendorf
>
> Have a form like:
> ...
>     <tr:form....>
>       <tr:panelFormLayout>
>         <tr:inputText id="ajax" label="Field 1:">
>           <f:ajax event="change" />
>         </tr:inputText>
>         <tr:inputText id="ppr" label="Field 2:" required="true">
>         </tr:inputText>
>       </tr:panelFormLayout>
>     </tr:form>
> ...
> Go to field1, type and TAB out:
> => An ajax request is queued and send down to the server
> In Trinidad (with autosubmit, instead of f:ajax) you'd see a warning that "Field 2" is required

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1906) Client Validation igonred with tag

Posted by "Andrew Robinson (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906906#action_12906906 ] 

Andrew Robinson commented on TRINIDAD-1906:
-------------------------------------------

I would vote that this is not a bug, and should not be fixed for Trinidad 2. f:ajax is a JSF tag, not a Trinidad tag and we should not have to support it with respect to client validation in JSF 2.0 for the following reasons.

I would say that we should wait for JSF 2.1 where, hopefully, the EG puts in API hooks to allow users to perform client side validation during a JSF ajax request. It was commented for JSF 2.0 that such a hook should exist and the EG dropped the ball on it and it was not included into the spec.  

A work around is to use the Trinidad APIs to submit the request. I would say that we could provide a tr:ajax that would be supported or we could hijack the f:ajax tag handler, although I would hesitate to do that as it would make Trinidad not "play nice" with other JSF libraries.

I do not feel that replacing the JSF request function is a good choice as we ought not to be messing with the JSF internal code if we can possibly help it.

> Client Validation igonred with <f:ajax> tag
> -------------------------------------------
>
>                 Key: TRINIDAD-1906
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1906
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 2.0.0.3-core
>            Reporter: Matthias Weßendorf
>
> Have a form like:
> ...
>     <tr:form....>
>       <tr:panelFormLayout>
>         <tr:inputText id="ajax" label="Field 1:">
>           <f:ajax event="change" />
>         </tr:inputText>
>         <tr:inputText id="ppr" label="Field 2:" required="true">
>         </tr:inputText>
>       </tr:panelFormLayout>
>     </tr:form>
> ...
> Go to field1, type and TAB out:
> => An ajax request is queued and send down to the server
> In Trinidad (with autosubmit, instead of f:ajax) you'd see a warning that "Field 2" is required

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1906) Client Validation igonred with tag

Posted by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906911#action_12906911 ] 

Matthias Weßendorf commented on TRINIDAD-1906:
----------------------------------------------

if we decorate f:ajax (or provide a tr:ajax) there is still the issue with vanilla JS call (jsf.ajax.request()).

Andrew, do you know if there is a ticket for the missing hooks? 

I am also not really looking to add an tr:ajax and yes, replacing the "request()" function is odd, but with that, folks can use jsf.ajax.request() on a "natural" base, and they don't notice any surprise. But sure... there is a downside for doing so.

Clearly: the JS API has limitations, and the real fix is that there should be hooks.

I will keep this ticket open, does not hurt to have one more open item, IMO :)

> Client Validation igonred with <f:ajax> tag
> -------------------------------------------
>
>                 Key: TRINIDAD-1906
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1906
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 2.0.0.3-core
>            Reporter: Matthias Weßendorf
>
> Have a form like:
> ...
>     <tr:form....>
>       <tr:panelFormLayout>
>         <tr:inputText id="ajax" label="Field 1:">
>           <f:ajax event="change" />
>         </tr:inputText>
>         <tr:inputText id="ppr" label="Field 2:" required="true">
>         </tr:inputText>
>       </tr:panelFormLayout>
>     </tr:form>
> ...
> Go to field1, type and TAB out:
> => An ajax request is queued and send down to the server
> In Trinidad (with autosubmit, instead of f:ajax) you'd see a warning that "Field 2" is required

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1906) Client Validation igonred with tag

Posted by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906769#action_12906769 ] 

Matthias Weßendorf commented on TRINIDAD-1906:
----------------------------------------------


For that we need to replace the request() function, provided by JSF


E.g. something like:
_replaceJsfAjaxFunctions = function()
{
  if (this._jsfAjaxInit || typeof this._window.jsf == "undefined" ||
    typeof this._window.jsf.ajax == "undefined")
  {
    return;
  }
  var a = jsf.ajax;
  a._origRequest = a.request;
  a._origAddOnEvent = a.addOnEvent;
  a._origAddOnError = a.addOnError;
  a.request = this.createCallback(_ourStuff_);
  a.addOnEvent = this.createCallback(_ourStuff_);
  a.addOnError = this.createCallback(_ourStuff_);
  this._jsfAjaxInit = true;
}

> Client Validation igonred with <f:ajax> tag
> -------------------------------------------
>
>                 Key: TRINIDAD-1906
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1906
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 2.0.0.3-core
>            Reporter: Matthias Weßendorf
>
> Have a form like:
> ...
>     <tr:form....>
>       <tr:panelFormLayout>
>         <tr:inputText id="ajax" label="Field 1:">
>           <f:ajax event="change" />
>         </tr:inputText>
>         <tr:inputText id="ppr" label="Field 2:" required="true">
>         </tr:inputText>
>       </tr:panelFormLayout>
>     </tr:form>
> ...
> Go to field1, type and TAB out:
> => An ajax request is queued and send down to the server
> In Trinidad (with autosubmit, instead of f:ajax) you'd see a warning that "Field 2" is required

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TRINIDAD-1906) Client Validation igonred with tag

Posted by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906916#action_12906916 ] 

Matthias Weßendorf commented on TRINIDAD-1906:
----------------------------------------------

as we now speak about client-side validation. Was there something promised for JSF 2.1 ?
(I don't really follow the "open" EG list)

> Client Validation igonred with <f:ajax> tag
> -------------------------------------------
>
>                 Key: TRINIDAD-1906
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1906
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>    Affects Versions: 2.0.0.3-core
>            Reporter: Matthias Weßendorf
>
> Have a form like:
> ...
>     <tr:form....>
>       <tr:panelFormLayout>
>         <tr:inputText id="ajax" label="Field 1:">
>           <f:ajax event="change" />
>         </tr:inputText>
>         <tr:inputText id="ppr" label="Field 2:" required="true">
>         </tr:inputText>
>       </tr:panelFormLayout>
>     </tr:form>
> ...
> Go to field1, type and TAB out:
> => An ajax request is queued and send down to the server
> In Trinidad (with autosubmit, instead of f:ajax) you'd see a warning that "Field 2" is required

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.