Default Value for Textfield inside multifield is not working as expected in touch Dialog | Community
Skip to main content
Level 2
Oct 7, 2022 11:32 AM UTC
Solved

Default Value for Textfield inside multifield is not working as expected in touch Dialog

Hi All,
Facing an issue for defaultvalue in textfield inside multfield for touch dialog. While authoring, I have removed the default value from dialog and saved it. In content the value is not present which is correct. Again when I reopen the dialog the defaultvalue in dialog is coming .Ideally it should not be coming because at content level it is not saving property. This is not happening for textfield with defaultvalue which is not used inside multifield.
FYI: I am using value property for default value in textfield inside multifield or without multifield.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
B_Sravan
B_SravanAccepted solution
New Participant
Oct 8, 2022 11:02 AM UTC

Hi @manikantach ,

 

value can't be used to have a default value ideally. Go through this render.jsp /libs/granite/ui/components/coral/foundation/form/textfield/render.jsp for all the available properties.

 

make use of "emptyText (String) i18n" to have a hint or it is best to use @Defualt in your sling model.

 

 @Inject @Default(values="defaultValue")
 private String name;

Thank you,

Sravan

3 replies

B_Sravan
B_SravanAccepted solution
New Participant
Oct 8, 2022 11:02 AM UTC

Hi @manikantach ,

 

value can't be used to have a default value ideally. Go through this render.jsp /libs/granite/ui/components/coral/foundation/form/textfield/render.jsp for all the available properties.

 

make use of "emptyText (String) i18n" to have a hint or it is best to use @Defualt in your sling model.

 

 @Inject @Default(values="defaultValue")
 private String name;

Thank you,

Sravan

Translate
Level 2
Oct 10, 2022 1:52 PM UTC

Hi @b_sravan ,

We cant use the @Default(values="defaultValue") in our sling model because if we dont enter any value while authoring in dialog the default value will be picked from sling model and will be rendered in page. But ideally if we dont enter anything in dialog it should not be rendered on page. The problem is not with code, but if we reopen the dialog it is setting the default value again if we dont author anything before. This is happening for textfield inside multifield and not for textfield which is not being used in multifield

Translate
Saravanan_Dharmaraj
New Participant
Oct 7, 2022 12:55 PM UTC

Use defaultValue as property to set default value

Translate