Uploaded image for project: 'Cocoon'
  1. Cocoon
  2. COCOON-1825

Ajax error when an active state widget become invisible state widget

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.9
    • 2.1.12, 2.3.0
    • Blocks: Forms
    • None
    • Patch available
    • Blocks: Forms - 1.0.0-RC3-SNAPSHOT
    • Blocks: Forms

    Description

      Some widget (field with selection-list and styling=radio, group, etc...) can not be hidden (state=invisible)in ajax mode.

      I declare some widgets without state attribute in the form definition, my form is in ajax mode, when I set the widget state to INVISIBLE, the ajax response can not be applied to the form because <span id="widget-name">...</span> is not available in source code.

      I think about 2 patches :
      *putting a <span></span> in forms-field-styling.xsl where is not set
      *or modifing abstractWidgetDefinition.java in ordre to generate a placeholder around each widget (but patch seems to need a lot of modification in forms-field-styling.xsl too)



      Here is the patch for first

      --- forms-field-styling.orig 2006-04-13 15:37:06.590221200 +0200
      +++ forms-field-styling.xsl 2006-04-13 15:38:22.525291200 +0200
      @@ -198,8 +198,9 @@
           <xsl:variable name="value" select="fi:value"/>
           <xsl:variable name="vertical" select="string(fi:styling/@list-orientation) != 'horizontal'"/>
           <xsl:choose>
      - <xsl:when test="$vertical">
      - <table id="{$id}" cellpadding="0" cellspacing="0" border="0" title="{fi:hint}">
      + <xsl:when test="$vertical">
      + <span id="{$id}">
      + <table id="{$id}" cellpadding="0" cellspacing="0" border="0" title="{fi:hint}">
                 <xsl:for-each select="fi:selection-list/fi:item">
                   <xsl:variable name="item-id" select="concat($id, ':', position())"/>
                   <tr>
      @@ -224,6 +225,7 @@
                   </tr>
                 </xsl:for-each>
               </table>
      + </span>
             </xsl:when>
             <xsl:otherwise>
               <span id="{$id}" title="{fi:hint}">
      @@ -682,22 +684,24 @@
             | know where to insert the widget if it becomes visible
             +-->
         <xsl:template match="fi:placeholder">
      - <span id="{@id}"/>
      + <span id="{@id}"><xsl:apply-templates/></span>
         </xsl:template>
         
         <!--+
             | fi:struct - has no visual representation by default
             +-->
         <xsl:template match="fi:struct">
      - <xsl:apply-templates/>
      + <span id="{@id}"><xsl:apply-templates/></span>
         </xsl:template>
       
         <!--+
             | fi:group - has no visual representation by default
             +-->
         <xsl:template match="fi:group">
      - <xsl:apply-templates/>
      + <span id="{@id}"><xsl:apply-templates/></span>
         </xsl:template>
      +
      +
       
         <xsl:template match="@*|node()" priority="-1">
           <xsl:copy>




      Here for the second


      --- AbstractWidget.orig 2006-04-13 15:31:07.851701200 +0200
      +++ AbstractWidget.java 2006-04-13 15:30:31.446616200 +0200
      @@ -483,6 +483,10 @@
           public void generateSaxFragment(ContentHandler contentHandler, Locale locale)
           throws SAXException {
       
      + AttributesImpl placeHolderAttrs = new AttributesImpl();
      + placeHolderAttrs.addCDATAAttribute("id", getRequestParameterName());
      + contentHandler.startElement(FormsConstants.INSTANCE_NS, "placeholder", FormsConstants.INSTANCE_PREFIX_COLON + "placeholder", placeHolderAttrs);
      +
               if (getCombinedState().isDisplayingValues()) {
                   // FIXME: we may want to strip out completely widgets that aren't updated when in AJAX mode
                   String element = this.getXMLElementName();
      @@ -497,15 +501,9 @@
       
                   generateItemSaxFragment(contentHandler, locale);
       
      - contentHandler.endElement(FormsConstants.INSTANCE_NS, element, FormsConstants.INSTANCE_PREFIX_COLON + element);
      -
      - } else {
      - // Generate a placeholder that can be used later by AJAX updates
      - AttributesImpl attrs = new AttributesImpl();
      - attrs.addCDATAAttribute("id", getRequestParameterName());
      - contentHandler.startElement(FormsConstants.INSTANCE_NS, "placeholder", FormsConstants.INSTANCE_PREFIX_COLON + "placeholder", attrs);
      - contentHandler.endElement(FormsConstants.INSTANCE_NS, "placeholder", FormsConstants.INSTANCE_PREFIX_COLON + "placeholder");
      + contentHandler.endElement(FormsConstants.INSTANCE_NS, element, FormsConstants.INSTANCE_PREFIX_COLON + element);
               }
      + contentHandler.endElement(FormsConstants.INSTANCE_NS, "placeholder", FormsConstants.INSTANCE_PREFIX_COLON + "placeholder");
           }
       
        public Object getAttribute(String name) {

      Attachments

        Activity

          People

            joerg.heinicke@gmx.de Jörg Heinicke
            vincent.demay@anyware-tech.com Vincent Demay
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: