Show value in coral textfield only once

Avatar

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

275 likes

Total Posts

320 posts

Correct reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

275 likes

Total Posts

320 posts

Correct reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
Anudeep_Garnepudi
MVP

23-09-2020

Hi,

 

I want to show the value in a Coral Text field only for the first time when the component is dropped and author opens the dialog. After first submit it should hold the value that has been authored in the dialog(any value or EMPTY).

Currently I am using value property to textfield and the behaviour is, if the author empty the field value and submit the dialog, on dialog re-open the filed is being populated with value that has been set in dialog properties. 

 

Is there a way that we can set the default value only once for the first time? I don't see the defaultValue property in the documentation.

TextField — Granite UI 1.0 documentation

Field — Granite UI 1.0 documentation

 

Thank you.

 

-AG

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile
Manjunath_K
MVP

23-09-2020

@Anudeep_Garnepudi 

value property added to dialog textfield provides default value, when author open dialog

 

1. If author empty the default value added & submit dialog then the field value will be posted & stores as blank. if author reopens the dialog then author will see empty value.

2. If author leaves default value as is & submit dialog then default value will be posted & stored. if author reopens the dialog then author will see default value prepopulated.

 

There will be no possibility that author remove/empty the default value, submit & then when author reopens the dialog its prepopulating the default value again.

 

<title
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldDescription="Configure form title"
fieldLabel="Form Title"
value="Form Title"
name="./title"/>

 

Answers (0)