create an article with empty note and save
go to the /administrator/components/com_content/forms/article.xml file and add a default value : default="ZZZZ"
save the article.xml
open the article
the value of the note field is : emtpy
the value of the note field is : ZZZ
J4.4.5
Labels |
Added:
No Code Attached Yet
|
Title |
|
It is working correctly. You have set a default value and that is being used
Thanks for you reply.
For me, a default value to the field is a value to display to the field when you create a new record, it's a proposition for an enduser.
it's not the same thing that the default value for the database when you receive a null value . If I have a decided to delete the default value to save a null value (because the field is not required), you can't display the default value after loading the record and after I have deleted the value.
Follow this question at an enduser : if you create an record and you see the quantity at 1 (by default), you delete this quantity and you save, what do you excpected ? many endusers will said : "empty result, because I have deleted the value". But the result will be 1...
So, in this case the default value to the field is the default value to the database when you receive a null value. in some case, for me, you want just to propose a value in a field for a new record
You are confusing default value and placeholder.
No, I know the difference. the placeholder is not a real value, you need to encode over it : https://www.w3schools.com/tags/att_input_placeholder.asp => The placeholder attribute specifies a short hint that describes the expected value of an input field
for me you are confusing default and required.
for you, you can't remplace a default value for empty? why, if the required is at false?
So in this case if you write a field with a default="ZZZ" value and required=false, it's the same thing that put the required=true :/ it's strange, no?
a default value, it's like you are initalizing a variable, you can delete the value after if you want.
A field it's just a way to an enduser to define a variable with some restrictions : readonly, required, default, ...
required means : you accept or not empty value.
default means : I have initalize the field for you, but you can replace the value, and if you want to delete the value (and you don't receive a warning like the field is required) I accept the value (and NOT I replace the empty value by the initalization value without inform you...)
no problem, that will be nice for joomla to have this difference with the required field, but I have try, no problem
thanks for your time
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-06-25 08:39:11 |
Closed_By | ⇒ | Fedik |
Thanks for the reaport.
It is expected behavior. It not realy possible to change it.
The Form uses the default value anytime when the field value is empty.
The Form does not know and does not care if it new or existing content.
It is working correctly. You have set a default value and that is being used