Default Value for Textfield inside multifield is not working as expected in touch Dialog | Community
Skip to main content
Level 2
October 7, 2022
Solved

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

  • October 7, 2022
  • 2 replies
  • 1817 views

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.
Best answer by B_Sravan

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

2 replies

Saravanan_Dharmaraj
Community Advisor
Community Advisor
October 7, 2022

Use defaultValue as property to set default value

B_Sravan
Community Advisor
B_SravanCommunity AdvisorAccepted solution
Community Advisor
October 8, 2022

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

Level 2
October 10, 2022

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