Hi,
I have a paragraph field. I need to hardcode a value, with the below code, the user can change the value. When I used the a!richtextdisplayfield, I was getting an error.
Can someone pls guide here.
a!paragraphField( label: "Rejection Comment",value: "REJECTION " & local!comment, saveInto: local!comment,)
Discussion posts and replies are publicly visible
hema.mathivathanan said:When I used the a!richtextdisplayfield
because a!richTextDisplayField() is a read-only component.
hema.mathivathanan said:value: "REJECTION " & local!comment,
So if you were trying to make it a READ-ONLY paragraph field, this would be an OK way to DISPLAY the value. However it's a bit more tricky if you want the text to show up in the field as a default but then save only the user input that follows that value - because, when "REJECTION " is included in the "value" field, that text populates into the user entry, and then it flows to the saveInto when the user changes the value of the field, so any time the user touches it, it'll save a redundant "REJECTION " at the front of the message.
There are ways around this involving manual work inside the saving, but honestly I fear it's just going to cause more confusion.
This makes me ask though, why the redundant "REJECTION" label *inside* the field value? What's wrong with using the... "label" as the label? What value does it add to have the word again?
It's a requirement where we have "Rejection" followed by where the user can enter text. If I give value: "rejection" & local!comment, the user can delete the word "Rejection" or make changes to it. But, I need it to stay the same.
Do we have a way to do it
Why not just add that word on submit?
Yeah, i'll echo what Stefan said - you can manipulate the value of the user-entered text however you want AFTER the user is done with it. You don't NEED to have that extra text sitting inside the text entry box during user entry.
a!buttonWidget( label: "Submit", /* for example */ submit: true(), saveInto: { ri!buttonClicked, /* for example */ a!save(ri!rejectionComment, "REJECTION " & local!comment) })
Of course!It is a question of logic - If there is something already in the field, you don't add the word 'Rejection' Only the first time.You have to replace the value expression with this one:
value: if(a!isNullOrEmpty(local!comment),"REJECTION " & local!comment,local!comment),
Thanks, I will use the value in the "submit" button