Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

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

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @manikanta290719 ,

 

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

View solution in original post

3 Replies

Avatar

Community Advisor

Use defaultValue as property to set default value

Avatar

Correct answer by
Community Advisor

Hi @manikanta290719 ,

 

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

Avatar

Level 2

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