0

In my custom component, inside the forms, I have several list fields. Some are normal list fields, others are sql fields.

All of these show "Select an option" as a header. I can't find the way to change this text to something more appropriate.

The Joomla docs state I could use an attibute in xml form, like header="Select custom option". Sadly, this doesn't have any effect. I Allways see the default text "Select an option".

enter image description here

Any tips on how to change this? I am looking for a translatable solution.

  • 1
    Please show us how and where you are implementing your attempt to override the placeholder text. – mickmackusa Mar 11 at 2:35
  • This page appears to be abandoned. Has Thiago's advice resolved your question? If so, please award the green tick to his answer. If not and you managed to resolve it yourself, please post an educational answer and award that answer with the green tick. If your question remains unresolved, please edit your question to add any newly discovered details and state any progress that you have made. Please never abandon your questions here. – mickmackusa Aug 30 at 11:09
0

You can use a constant like COMPONENT_OPTION_FIELD and define that constant in your language ini file like this: COMPONENT_OPTION_FIELD="Select Custom Option"

You can also go to your administrator panel, then go to

Extensions > Languages > Overrides

On Overrides page, select the language you want to override the text and click on New. On the right side, there's an option to search the value which is "Select an option" without "" and make sure "The Search For" option is set to "Value" and click on search. Click on the result you got and it will be added to the Language Constant field on the left side, then, in the "Text" input, you change the text to "Select custom option" or whatever name you want to and click in save.

UPDATE:

You can also change the field list in your xml file; change it to, for example:

   <field name="mylistvalue" type="list" default="Select an option"
       required="true" label="Select an option" description=""> 
         <option>value="">Please Select</option>
         <option value="0">Option 1</option> 
        <option value="1">Option 2</option> 
    </field>

You can change "Select an option" and "Please Select" to whatever value you want.

The same thing can be applied to a field of type SQL

<field
    name="title"
    type="sql"
    default="10"
    label="Select an article"
    query="SELECT id AS value, title FROM #__content"
  />

change "Select an article" to whatever you want. You can even populate the default value with a database record by just changing default="Select an article" to your column name. default="yourColumnName"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.