You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Philippe Gassmann (JIRA)" <ji...@apache.org> on 2005/11/17 12:13:41 UTC

[jira] Created: (COCOON-1687) [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null

[PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null
----------------------------------------------------------------------------------------------------

         Key: COCOON-1687
         URL: http://issues.apache.org/jira/browse/COCOON-1687
     Project: Cocoon
        Type: Bug
  Components: Blocks: Forms  
    Versions: 2.1.8-dev (Current SVN), 2.2-dev (Current SVN), 2.1.7    
    Reporter: Philippe Gassmann
 Attachments: ValueJXPathBinding.java.patch

When a form is saved using a JXPathBinding, the xml elements that correspond to null widget values must be removed.

Here is our problem : we have a form containing a "date widget" that is not mandatory,

1. the user wants to set a value to this widget ex 2005/05/09
2. the user save this form
3. the user does not want the date to be set anymore (why ? why not !)
4. the user edit the value removing its content (ie the value of the widget will be null)
5. the user save the form
6. when the user wants to view what's happened, he see : the element containing the value of the date is present, if he loads the form again he found : 1970-01-01 in the date field (the org.w3c.util.DateParser return this value if empty string its given).

In general, it has no sense for kind of data (integer, float, date...) to have three "state" : empty, null and filled with a value !

So here is a patch to correct this : 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (COCOON-1687) [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null

Posted by "Jean-Baptiste Quenot (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COCOON-1687?page=comments#action_12426523 ] 
            
Jean-Baptiste Quenot commented on COCOON-1687:
----------------------------------------------

Just my opinion but this XML-based CForms binding API has a number of inconsistencies and bugs.  I doubt that we will ever be able to find a syntax that fits all use-cases.  I'd advise to write the binding using <fb:javascript> or <fb:java> which is much more reliable.

> [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null
> ----------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-1687
>                 URL: http://issues.apache.org/jira/browse/COCOON-1687
>             Project: Cocoon
>          Issue Type: Bug
>          Components: Blocks: Forms
>    Affects Versions: 2.1.8, 2.2-dev (Current SVN), 2.1.7
>            Reporter: Philippe Gassmann
>         Attachments: ValueJXPathBinding.java.patch
>
>
> When a form is saved using a JXPathBinding, the xml elements that correspond to null widget values must be removed.
> Here is our problem : we have a form containing a "date widget" that is not mandatory,
> 1. the user wants to set a value to this widget ex 2005/05/09
> 2. the user save this form
> 3. the user does not want the date to be set anymore (why ? why not !)
> 4. the user edit the value removing its content (ie the value of the widget will be null)
> 5. the user save the form
> 6. when the user wants to view what's happened, he see : the element containing the value of the date is present, if he loads the form again he found : 1970-01-01 in the date field (the org.w3c.util.DateParser return this value if empty string its given).
> In general, it has no sense for kind of data (integer, float, date...) to have three "state" : empty, null and filled with a value !
> So here is a patch to correct this : 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Reopened: (COCOON-1687) [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null

Posted by "Marc Portier (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COCOON-1687?page=all ]

Marc Portier reopened COCOON-1687:
----------------------------------

             
The applied patch introduces an undesired side-effect:

suppose you have a binding that looks like
<fb:context path="elem">
  <fb:value id="x" path="@x" />
  <fb:value id="y" path="@y" />
  <fb:value id="text" path="." />
</fb:context>

and have an xml that looks like this:
<elem x="a" y="b />

then just rountripping load-save of this through the binding will REMOVE the element since the value of 'text; is set to 'null' and the save-back executes the removepath() now.


Need to give it more thought, but I'ld suggest 
1/ introducing some configuration attribute @remove-if-null="true|false" on the fb:value to cater for the two possible use -cases.
2/ although that would break compaibility for a 2nd time make the value 'false' the default.



> [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null
> ----------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-1687
>                 URL: http://issues.apache.org/jira/browse/COCOON-1687
>             Project: Cocoon
>          Issue Type: Bug
>          Components: Blocks: Forms
>    Affects Versions: 2.1.8, 2.2-dev (Current SVN), 2.1.7
>            Reporter: Philippe Gassmann
>         Attachments: ValueJXPathBinding.java.patch
>
>
> When a form is saved using a JXPathBinding, the xml elements that correspond to null widget values must be removed.
> Here is our problem : we have a form containing a "date widget" that is not mandatory,
> 1. the user wants to set a value to this widget ex 2005/05/09
> 2. the user save this form
> 3. the user does not want the date to be set anymore (why ? why not !)
> 4. the user edit the value removing its content (ie the value of the widget will be null)
> 5. the user save the form
> 6. when the user wants to view what's happened, he see : the element containing the value of the date is present, if he loads the form again he found : 1970-01-01 in the date field (the org.w3c.util.DateParser return this value if empty string its given).
> In general, it has no sense for kind of data (integer, float, date...) to have three "state" : empty, null and filled with a value !
> So here is a patch to correct this : 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (COCOON-1687) [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null

Posted by "Marc Portier (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COCOON-1687?page=comments#action_12427215 ] 
            
Marc Portier commented on COCOON-1687:
--------------------------------------

Reverted this patch:
http://svn.apache.org/viewvc?view=rev&revision=430378

This patch was shipped with the 2.1.9 release of cocoon. 
Because of that, people on that version seeing unwanted removal of elements during bind-save will need to resort to some sort of workaround.

A typical sample is to replace an ordinary

<fb:value id="whatever" path="whatever" />

with: 

<fb:value id="whatever" path="whatever" direction="load"/>
<fb:javascript id="whatever" path="whatever" direction="save">
    <save-form>
      if (widget.getValue() != null)
      {
        jxPathPointer.setValue(widget.getValue());
      }
      else
      {
        jxPathPointer.setValue("");
      }
    </save-form>
</fb:javascript>


> [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null
> ----------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-1687
>                 URL: http://issues.apache.org/jira/browse/COCOON-1687
>             Project: Cocoon
>          Issue Type: Bug
>          Components: Blocks: Forms
>    Affects Versions: 2.1.8, 2.2-dev (Current SVN), 2.1.7
>            Reporter: Philippe Gassmann
>         Attachments: ValueJXPathBinding.java.patch
>
>
> When a form is saved using a JXPathBinding, the xml elements that correspond to null widget values must be removed.
> Here is our problem : we have a form containing a "date widget" that is not mandatory,
> 1. the user wants to set a value to this widget ex 2005/05/09
> 2. the user save this form
> 3. the user does not want the date to be set anymore (why ? why not !)
> 4. the user edit the value removing its content (ie the value of the widget will be null)
> 5. the user save the form
> 6. when the user wants to view what's happened, he see : the element containing the value of the date is present, if he loads the form again he found : 1970-01-01 in the date field (the org.w3c.util.DateParser return this value if empty string its given).
> In general, it has no sense for kind of data (integer, float, date...) to have three "state" : empty, null and filled with a value !
> So here is a patch to correct this : 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (COCOON-1687) [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null

Posted by "Jean-Baptiste Quenot (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COCOON-1687?page=comments#action_12427134 ] 
            
Jean-Baptiste Quenot commented on COCOON-1687:
----------------------------------------------

See http://marc.theaimsgroup.com/?t=115502476800003&r=1&w=2

The discussion on cocoon-dev concludes that the initial fix may not be necessary because most Cocoon users may not have been impacted by this problem: the date problem may not happen with SimpleDateFormat because it is lenient by default.  Reverting this change seems the more simple way to close the issue.

Contribution to add an optional knob to control node removal for null widget values is more than welcome however.

> [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null
> ----------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-1687
>                 URL: http://issues.apache.org/jira/browse/COCOON-1687
>             Project: Cocoon
>          Issue Type: Bug
>          Components: Blocks: Forms
>    Affects Versions: 2.1.8, 2.2-dev (Current SVN), 2.1.7
>            Reporter: Philippe Gassmann
>         Attachments: ValueJXPathBinding.java.patch
>
>
> When a form is saved using a JXPathBinding, the xml elements that correspond to null widget values must be removed.
> Here is our problem : we have a form containing a "date widget" that is not mandatory,
> 1. the user wants to set a value to this widget ex 2005/05/09
> 2. the user save this form
> 3. the user does not want the date to be set anymore (why ? why not !)
> 4. the user edit the value removing its content (ie the value of the widget will be null)
> 5. the user save the form
> 6. when the user wants to view what's happened, he see : the element containing the value of the date is present, if he loads the form again he found : 1970-01-01 in the date field (the org.w3c.util.DateParser return this value if empty string its given).
> In general, it has no sense for kind of data (integer, float, date...) to have three "state" : empty, null and filled with a value !
> So here is a patch to correct this : 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (COCOON-1687) [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null

Posted by "Feliciano Borrego (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COCOON-1687?page=comments#action_12428378 ] 
            
Feliciano Borrego commented on COCOON-1687:
-------------------------------------------

I closed the issue 1863:
http://issues.apache.org/jira/browse/COCOON-1863

> [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null
> ----------------------------------------------------------------------------------------------------
>
>                 Key: COCOON-1687
>                 URL: http://issues.apache.org/jira/browse/COCOON-1687
>             Project: Cocoon
>          Issue Type: Bug
>          Components: Blocks: Forms
>    Affects Versions: 2.1.8, 2.2-dev (Current SVN), 2.1.7
>            Reporter: Philippe Gassmann
>         Attachments: ValueJXPathBinding.java.patch
>
>
> When a form is saved using a JXPathBinding, the xml elements that correspond to null widget values must be removed.
> Here is our problem : we have a form containing a "date widget" that is not mandatory,
> 1. the user wants to set a value to this widget ex 2005/05/09
> 2. the user save this form
> 3. the user does not want the date to be set anymore (why ? why not !)
> 4. the user edit the value removing its content (ie the value of the widget will be null)
> 5. the user save the form
> 6. when the user wants to view what's happened, he see : the element containing the value of the date is present, if he loads the form again he found : 1970-01-01 in the date field (the org.w3c.util.DateParser return this value if empty string its given).
> In general, it has no sense for kind of data (integer, float, date...) to have three "state" : empty, null and filled with a value !
> So here is a patch to correct this : 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] Closed: (COCOON-1687) [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null

Posted by Joerg Heinicke <jo...@gmx.de>.
On 16.01.2006 18:45, Jean-Baptiste Quenot (JIRA) wrote:

>      [ http://issues.apache.org/jira/browse/COCOON-1687?page=all ]
>      
> Jean-Baptiste Quenot closed COCOON-1687:
> ----------------------------------------
> 
>     Resolution: Fixed
> 
> See http://svn.apache.org/viewcvs.cgi?rev=369507&view=rev

Just a hint: you don't need to add this as comment as Jira finds this 
out itself: 
http://issues.apache.org/jira/browse/COCOON-1687?page=com.atlassian.jira.plugin.ext.subversion:subversion-commits-tabpanel
You probably only need "COCOON-XXXX" in the commit message.

Jörg

[jira] Closed: (COCOON-1687) [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null

Posted by "Jean-Baptiste Quenot (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/COCOON-1687?page=all ]
     
Jean-Baptiste Quenot closed COCOON-1687:
----------------------------------------

    Resolution: Fixed

See http://svn.apache.org/viewcvs.cgi?rev=369507&view=rev

> [PATCH] JXPATHBinding : when saving the form, remove xml elements if the value of the widget is null
> ----------------------------------------------------------------------------------------------------
>
>          Key: COCOON-1687
>          URL: http://issues.apache.org/jira/browse/COCOON-1687
>      Project: Cocoon
>         Type: Bug
>   Components: Blocks: Forms
>     Versions: 2.1.8, 2.2-dev (Current SVN), 2.1.7
>     Reporter: Philippe Gassmann
>  Attachments: ValueJXPathBinding.java.patch
>
> When a form is saved using a JXPathBinding, the xml elements that correspond to null widget values must be removed.
> Here is our problem : we have a form containing a "date widget" that is not mandatory,
> 1. the user wants to set a value to this widget ex 2005/05/09
> 2. the user save this form
> 3. the user does not want the date to be set anymore (why ? why not !)
> 4. the user edit the value removing its content (ie the value of the widget will be null)
> 5. the user save the form
> 6. when the user wants to view what's happened, he see : the element containing the value of the date is present, if he loads the form again he found : 1970-01-01 in the date field (the org.w3c.util.DateParser return this value if empty string its given).
> In general, it has no sense for kind of data (integer, float, date...) to have three "state" : empty, null and filled with a value !
> So here is a patch to correct this : 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira