When using a!paragraphField, we have refreshAfter: set to "KEYPRESS".

Certified Senior Developer
When using a!paragraphField, we have refreshAfter: set to "KEYPRESS". We want to limit the character count in the paragraph field, which works by truncating in the saveInto, and we can provide a live character count in the instructions below, however the user may still enter additional characters into the paragraph, and they don't get cut off until the field loses focus (they tab or click outside of it). Is there any way to immediately reflect the truncated value in the paragraph field while they are typing?

OriginalPostID-142471

OriginalPostID-142471

  Discussion posts and replies are publicly visible

Parents
  • I think its better to show validation for it rather than disabling paragraph field. Your code became like
    load(
              local!value,
              a!paragraphField(
                        label: ri!label,
                        value: local!value,
                        saveInto: {
                                  a!save(ri!output,rule!SAIL_UTIL_limitInputSize(save!value,ri!maxCharacters)),
                                  a!save(local!value,rule!SAIL_UTIL_limitInputSize(save!value,ri!maxCharacters))
                        },
                        validations: {
                                  if(len(trim(local!value)>100,"Please enter less than 100 letters.","")
                        },
                        required: ri!required,
                        instructions: ri!instructions& if(and(not(rule!APN_isBlank(ri!instructions)),not(isnull(ri!maxCharacters))),
                                  " ",
                                  ""
                         )&
                         if(not(isnull(ri!maxCharacters)),
                                  len(local!value) & " of " & ri!maxCharacters & " characters entered. This text field is limited to " & ri!maxCharacters & " characters.",
                                  ""
                                  ),
                        readOnly: ri!readOnly,
                        requiredMessage: ri!requiredMessage,
                        refreshAfter: "KEYPRESS"
    )
    )
Reply
  • I think its better to show validation for it rather than disabling paragraph field. Your code became like
    load(
              local!value,
              a!paragraphField(
                        label: ri!label,
                        value: local!value,
                        saveInto: {
                                  a!save(ri!output,rule!SAIL_UTIL_limitInputSize(save!value,ri!maxCharacters)),
                                  a!save(local!value,rule!SAIL_UTIL_limitInputSize(save!value,ri!maxCharacters))
                        },
                        validations: {
                                  if(len(trim(local!value)>100,"Please enter less than 100 letters.","")
                        },
                        required: ri!required,
                        instructions: ri!instructions& if(and(not(rule!APN_isBlank(ri!instructions)),not(isnull(ri!maxCharacters))),
                                  " ",
                                  ""
                         )&
                         if(not(isnull(ri!maxCharacters)),
                                  len(local!value) & " of " & ri!maxCharacters & " characters entered. This text field is limited to " & ri!maxCharacters & " characters.",
                                  ""
                                  ),
                        readOnly: ri!readOnly,
                        requiredMessage: ri!requiredMessage,
                        refreshAfter: "KEYPRESS"
    )
    )
Children
No Data