Dynamic number of fields in Joomla module - joomla

I just started to work with Joomla 3 and I'm trying to create a simple module for a jQuery based gallery.
I have 2 simple form fields:
<field name="img_src_1" type="text" size="60" default="" label="" description="" />
<field name="img_name_1" type="text" size="60" default="" label="" description="" />
Is there any way to add more images fields without duplicating those two lines with different names? (img_src_2,img_src_3...)
It will be very nice for the user to choose how many images he would like, without hard-coding it.

Related

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!

maxlength is not working in joomla 2.5 form fields

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.

Telerik combo background design

I couldn't figure how to get the combo box looks like the payment method combo box from this link https://demos.telerik.com/aspnet-ajax/combobox/examples/overview/defaultcs.aspx#qsf-demo-source
The source they provide doesn't seems to have any different from each other, but I need that filled combobox design from the 4th one. Just doesn't know how to get it.
If you press the View Source, then goto 'PaymentMethods.xml' you will see the method used for assigning (Xml taken directly from this Telerik Demo)
<Items>
<Item Text="American Express" Value="1" ImageUrl="Images/card-types/american-express.png" />
<Item Text="MasterCard" Value="2" ImageUrl="Images/card-types/mastercard.png" />
<Item Text="Visa" Value="3" ImageUrl="Images/card-types/visa.png" />
<Item Text="Visa Electron" Value="4" ImageUrl="Images/card-types/visa-electron.png" />
</Items>
There are other methods for adding images using the ImageUrl attribute (See this Telerik Demo)
Alternatively you might want to use the ItemTemplate should you want further control (See this Telerik Demo) This also allows you to put further details in the drop down list which is particularly useful when you want to display a little more information.
<ItemTemplate>
<asp:Label ID="lblOptionTitle" runat="server" Text='<%# Eval('ItemTitle') %>' Font-Bold="true" />
<asp:Label ID="lblOptionText" runat="server" Text='<%# Eval('ItemText') %>' />
<img id="imgOption" alt="Alternative Text" src='<%# Eval('ImageUrl') %>' />
</ItemTemplate>

Whats the easiest way to add custom style to the module parameters form at the admin in Joomla?

My simple module using 3 field, 2 text input and a tinymce textarea, but the textarea looks broken. http://img151.imageshack.us/img151/8648/joomla464.jpg
This is my config:
<config>
<fields name="params">
<fieldset name="basic">
<field name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />
<field name="url" type="text" default="" label="Paste the url" description="" />
<field style="clear:both;float:left;background-color:red;" name="description" type="editor" default="default" rows="20" cols="40" />
</fieldset>
</fields>
</config>
ty
You could add your css to
administrator/templates/bluestork/css/template.css (That is if your using the default administration template)
but there is a risk when joomla updates you will lose your css... you could alwasy copiy the template... give it a diffrent name and update the css there. so your copie wont be affected by any joomla update.
so adding your css there you just need to use the right css selector.
Otherwise i would use an artical selector or category selector
<field
name="category_id"
type="category"
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
extension="com_content"
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
show_root="true"
required="true" />
And put what ever content you need in an artical.. you dont have much room to put the editor on the right for the modules configurations anyway.

Spring FORM tag library - radiobutton, loading its LABEL attribute from a message source

I am working on a spring MVC-based application and use the spring tag library for form data binding. I happily used the tag until I realised that the labels associated with individual radios were not picked up from the message source but I had them hard-coded in the JSP. I somehow failed to notice before, so now I was like going to fix this and here I encounter a silly little problem, which I hope you will be able to help me with.
Ok, this works:
<form:radiobutton path="metric" value="0" label="inches" />
<form:radiobutton path="metric" value="1" label="centimeters" />
This does not.
<form:radiobutton path="metric" value="0" label="<fmt:message key="label.calculator.units.imperial" />" />
<form:radiobutton path="metric" value="1" label="<fmt:message key="label.calculator.units.metric" /> " />
The problem is the nesting of the fmt:message tag within the format:radiobutton tag. I get Caused by: org.apache.jasper.JasperException: /WEB-INF/jsp/calculator/calculator.jsp(15,100) PWC6212: equal symbol expected in the stack trace.
Is there any other way to make the radio buttons' labels to load from the message source? I guess I could use <c-rt:set> to first set the message text from the message source into a variable and then ${varname} it into the label="" attribute... but that seems a little long-winded. Any suggestions?
Haven't used the <form:radiobutton> tag very often, but as far as I know you have no choice but to set the message into a variable and then use it like label="${varname}".
One other option would be to loose the label attribute and just print a label by hand, something like:
<spring:message code="label.calculator.units.imperial" /><form:radiobutton path="metric" value="0" />
<spring:message code="label.calculator.units.metric" /><form:radiobutton path="metric" value="1" />
Off course the HTML result will differ. You'll have to control the label yourself instead of the radio button tag generating a <label for="...".
It is possible, set the 'var' attribute of the spring:message tag:
<spring:message var="inches" code="label.calculator.units.imperial"/>
<spring:message var="centimeters" code="label.calculator.units.imperial"/>
<form:radiobutton path="metric" value="0" label="${inches}"/>
<form:radiobutton path="metric" value="1" label="${centimeters}"/>

Resources