Adding richtextfield (custom component) inside a grid

We have a richtextfield as an input and saving the generated (html) text in the db,

basically we want to show the styled text inside a grid but when we tried it, 
this error was encountered

Interface Definition: Expression evaluation error at function a!gridLayout [line 13]: A grid layout component [label=“”] has an invalid value for “rows”. The row layout at index 1 contains a component that is not supported in the grid layout. Received CertifiedSAILExtension

is there any workaround for this?

Help would be much appreciated
Thanks!

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to aristotlem0001

    This 3-rule suite can be used to do a good portion of your formatting - it doesn't (yet) handle lists, sizes, colors, or headers, but can do bold, italic, underline, and hyperlinks, even nested together.  It can probably be extended to handle the stuff you need to do, just by adding more to the processing rule in the same vein as what I've already done for the other formats (though lists might be a particular challenge).  Note also that this requires the Regex utilities plug-in.

    /* rule!GLBL_CMPT_RichTextHTMLPreview */
    a!localVariables(
      local!formatBreakdown: rule!GLBL_UTIL_GetParsedRichTextBreakdown(htmlText: ri!htmlText),
      
      a!richTextDisplayField(
        label: ri!label,
        labelPosition: rule!GLBL_replaceNull(ri!labelPosition, "COLLAPSED"),
        instructions: ri!instructions,
        showWhen: ri!showWhen,
        value: {
          a!forEach(
            local!formatBreakdown,
            a!richTextItem(
              text:  rule!GLBL_UTIL_FormatHTMLLinebreaksForTextDisplay(
                htmlText: fv!item.row
              ),
              style: {
                fv!item.formats
              },
              link: a!safeLink(
                uri: fv!item.link,
                showWhen: not(rule!GLBL_isBlank(fv!item.link))
              )
            )
          )
        }
      )
    )
    
    /* rule!GLBL_UTIL_GetParsedRichTextBreakdown */
    a!localVariables(
      local!formatChangeMarker: "[[[formatChange]]]",
    
      local!test: regexreplaceall(
        pattern: "(<[biu]>|<a href="".+?""|</[biua]>)",
        searchstring: ri!htmltext,
        replacementString: local!formatChangeMarker & "$1"
      ),
      local!array: split(local!test, local!formatChangeMarker),
    
      local!formatMarks: a!forEach(
        local!array,
    
        tostring(
          if(
            left(fv!item, 8) = "<a href=",
            "a{{" & extract(fv!item, "<a href=""", """>") & "}}",
            extract(
              left(fv!item, 4),
              "<",
              ">"
            )
          )
        )
      ),
    
      a!forEach(
        local!formatMarks,
        with(
          local!list: joinarray(index(local!formatMarks, enumerate(fv!index)+1), ";"),
          local!list1: regexreplaceall( "b(.+?)/b", local!list, "$1"),
          local!list2: regexreplaceall( "i(.+?)/i", local!list1, "$1"),
          local!list3: regexreplaceall( "u(.+?)/u", local!list2, "$1"),
          local!list4: regexreplaceall( "a\{\{.+?\}\}(.+?)/a", local!list3, "$1"),
          {
            row: regexreplaceall("<[bui]>|<a href="".+?"">|</[buia]>", local!array[fv!index], ""),
            formats: touniformstring(
              a!forEach(
                rule!GLBL_UTIL_removeBlankValuesFromArray( trim(split(local!list4, ";")) ),
                if(
                  fv!item = "i",
                  "EMPHASIS",
                  fv!item = "b",
                  "STRONG",
                  fv!item = "u",
                  "UNDERLINE",
                  left(fv!item,1) = "a",
                  {},
                  ""
                )
              )
            ),
            link: tostring(
              rule!GLBL_UTIL_removeBlankValuesFromArray(
                touniformstring(
                  a!forEach(
                    trim(split(local!list4, ";")),
                    extract(fv!item, "a{{", "}}")
                  )
                )
              )
            )
          }
        )
      )
    )
    
    
    /* rule!GLBL_UTIL_FormatHTMLLinebreaksForTextDisplay */
    a!localVariables(
      local!lineBrokenText: regexreplaceall(
        "<br */*>",
        substitute(
          substitute(ri!htmlText, char(13), ""),
          char(10), 
          ""
        ),
        char(10)
      ),
      
      local!lineBrokenText
    )