maxlength is not working in joomla 2.5 form fields - joomla

I am having an issue when using below code in plugin xml in Joomla 2.5 version.
maxlength is not working.
<field name="phone" type="text" default="" label="Phone"
description="Phone: Must not be greater than 13 numbers" maxlength="13" />
or
<param name="phone" type="text" default="" label="Phone"
description="Phone: Must not be greater than 13 numbers" maxlength="13" />
Please let me know what need to be done or i am doing wrong.
Thanks in advance.

You should definitely be using the first bit of code you've provided in your extension as Joomla 2.5 uses <field>, not <param>.
So once you have many any changes to the XML file, you need to ensure you open the Plugin in the Joomla backend, and click "Save" which will apply any changes made.

Related

Reg: Placeholder in the search box

I have created a slickGrid APP and want to have placeholders in the search box. I can see an example in the Angular version of the slickgrid, yet couldnt see its code. I am however using the Javascript version.
Can someone help?
Thank you,
B
Check out http://6pac.github.io/SlickGrid/examples/example-header-row.html as an example.
The filter boxes are created using:
grid.onHeaderRowCellRendered.subscribe(function(e, args) {
$(args.node).empty();
$("<input type='text'>")
.data("columnId", args.column.id)
.val(columnFilters[args.column.id])
.appendTo(args.node);
});
So just add the 'placeholder' attribute to the box, eg:
<input type="text" name="fname" placeholder="First name">

CanJS - Two way binding

How to do two-way binding using CanJS?
Enter the Text : <input type="text" name="name" can-value="enteredText" />
Display the Text: {{enteredText}}
Can show multiple approaches? Using ViewModel ?
can-value was the old method in v2. In Canjs 4.0, you would do two way binding like this:
Enter the Text : <input type="text" name="name" value:bind="enteredText" />
Display the Text: {{enteredText}}
See: https://canjs.com/doc/can-stache-bindings.twoWay.html
Here's a jsbin demonstrating the syntax:
http://jsbin.com/vogavevico/edit?html,js,console,output
Please have a look here (docu for v2 and for v3).
At least if you use the (nowadays recommended) components approach you can write
<my-component {(some-prop)}="value"/><!-- v2 -->
<!-- syntax for v3 remains: {(prop)}="key" for two-way binding. -->
This is from the documentation.

Length of URL Language Code in Joomla 2.5

I need to change the content language URL Code for the french part of a Website to "costumes" (Found in the language manager under "content"). However the field stops after 7 letters, so that the last "s" is cut of.
I want to change that because the website-languages where set up as categories before, so that the french part is indexed by Google and others like that. Is there a way to allow 8 letters in this field?
Please try to change maxlength variable from file: /administrator/components/com_languages/models/forms/language.xml
<field name="lang_code" type="text"
description="COM_LANGUAGES_FIELD_LANG_TAG_DESC"
label="COM_LANGUAGES_FIELD_LANG_TAG_LABEL"
maxlength="7"
required="true"
size="10"
/>
<field name="sef" type="text"
description="COM_LANGUAGES_FIELD_LANG_CODE_DESC"
label="COM_LANGUAGES_FIELD_LANG_CODE_LABEL"
maxlength="7"
required="true"
size="10"
/>
This is a core change and every time you upgrade your joomla installation you have to check if it is getting overridden. If you want to create an override, you will need a 3rd party plugin.
Good Luck!

How to set parameters in menu Item Joomla Component

Following is my code.
<fields name="request">
<fieldset name="request">
<field name="format" type="list" label="COM_CPS_FIELD_FORMAT"
description="COM_CPS_FIELD_FORMAT_DESC" class="small"
default="raw"
>
<option value="">COM_CPS_FORMAT_HTML</option>
<option value="raw">COM_CPS_FORMAT_RAW</option>
</field>
</fieldset>
</fields>
When I save the menu with 2nd option it save the url like this index.php?option=com_cps&view=webservice&format=raw but when I save the menu with first option it does not remove the &format=raw If any one can help me out It would be great.
Default is defined as what to save if nothing is posted. It works like a Joomla input filter in that it changes what is actually saved as opposed to validation which stops the process and never posts. Therefore you cannot save nothing, since it will always be replaced by the default. Therefore if you want to be able to save blank you must not have a default.
What you may be looking for is a preset, which is a preselected value that can be unselected. Presets and defaults are totally different things although on the surface they appear similar.

Joomla 2.5 registration custom field as dropdown?

I added some extra field to Joomla 2.5. Everything working great. For example, I added "country" to registration.xml (components/com_users/models/forms):
<field name="country" type="text"
description="COM_USERS_REGISTER_COUNTRY_DESC"
filter="string"
label="COM_USERS_REGISTRATION_COUNTRY"
required="true"
size="40"
/>
But how to add a dropdown list? I want to give my users ability to select country from the list.
And similar question: I also added birthday field. How to add jQuery datepicker here?
In my opinion you should not edit Joomla core files. This could break your installation in future updates.
Although I don't recommend it, take a look at Standard form field and parameter types # Joomla Docs. At that page, see list for your dropdown list and calendar for your date.
Another way of adding extra fields would be with a extension. Check out:
ExtendedReg (commercial)
Community Builder
Joomla 2.5 has a 'profile' plugin to handle extra registration fields. You can edit that or write your own plugin. This avoids editing core files. Example of a country list using a database call (your database must have the table of counties). My table has country codes in two and three letters and I want to save the 3 letter code (example CAD).
<field
name="country"
type="sql"
id="country"
description="PLG_USER_PROFILE_FIELD_COUNTRY_DESC"
filter="string"
label="PLG_USER_PROFILE_FIELD_COUNTRY_LABEL"
message="PLG_USER_PROFILE_FIELD_COUNTRY_MESSAGE"
query="SELECT country_3_code as value, country_name as country FROM #__mycomponent_country
ORDER by country"
/>
For birthday use:
<field
name="birthday"
type="calendar"
label="Birth Day"
description="My Desc."
/>
And for country use the SQL as mentioned by #Gord Fisch

Resources