Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
10

The possible filters are: rules (Access Control Rules) unset (Do nothing, thus leaving the return value as null) raw (No filter) int_array (Filter the input as an array of integers) safehtml (Filter safe HTML) server_utc (Convert a date to UTC based on the server timezone offset) user_utc (Convert a date to UTC based on the user timezone offset) url (URL ...


6

Found what the issue is. I was using getInput function to show the field. $this->form->getInput('field2'); but showon attribute working only if I render the field using renderField function $this->form->renderField('field2'); Hope this helps someone facing the same issue


6

1. How to get Modules parameters inside Helper Function You are going all wrong with this. First, you can't use $this inside a static method, because they are independent of any instantiated object. Static methods can be called without instantiating an object so there is no $this reference inside. http://php.net/manual/en/language.oop5.static.php Just ...


6

I much prefer going for the OOP approach. This is what I use in one of my extensions. It's Ajax based so I have a separate function to get the parameters. helper.php: class ModSomethingHelper { private $params = null; public function __construct($title) { $this->params = $this->getParams($title); } public function ...


5

You can either make your own options (see Hasanalsamra's answer) or use the filter option of the status field: <field name="state" type="status" filter="*,0,1,-2" label="JOPTION_SELECT_PUBLISHED" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_PUBLISHED</option> </field> For reference: * ...


5

You need to load chosen plugin to style list box fields like this. Load chosen plugin first in your form layout file so that it can add style to your select boxes JHtml::_('formbehavior.chosen', 'select'); Add following class name to your form field (optional if you want to color it as mandatory field) class="chzn-color-state" To render the field on ...


5

Try this , Normally Joomla provides all major components categories in XML accessible way. For eg: you need banner category dropdown simply use like below. <field name="catid" type="category" extension="com_banners" label="JCATEGORY" multiple="true" size=...


5

What should happen is that you pass a string of comma separated values into the form field of the buttons that you do not want to appear. This gets exploded into an array here: https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/form/field/editor.php#L222 In the form field you get a JEditor Instance and in the getButtons method there it will ...


5

Set a comma separated property "checked" in the XML file rather than using default and you should be good. We also do not call trim on the comma separated values as having spaces in values is allowed by the W3C spec. So ensure there are no surplus spaces :)


5

I guess the example you are talking about is this: "SELECT e.* FROM #__example AS e GROUP BY name ORDER e.id ASC" Ths basically mean select everything from the table #__example (which has an alias name in the query of e) and group by name and order by id in ascending order. if you didn't use AS e in the query you had to write the query as follows: SELECT *...


4

I don't see any point to follow a tutorial for Joomla 1.5, when you try to work on J3. There are so many differences between the 2 versions. For what you want to do, a simple google search would give you plenty of resources. Here there are some: How to save Custom Fields in Core components Add custom / extra field to a category http://docs.joomla.org/...


4

I would suggest taking a look at http://docs.joomla.org/Creating_a_custom_form_field_type Since it looks like what you are trying to achieve. While the guide may be referring to components this can also work with modules, (I've tried it myself) simply follow the guide but instead of placing your files at /administrator/components/<name of your component&...


4

Try something like this: buttons = "true" | Show all buttons. hide = "article,image" | An array of the buttons you want to hide. <field name="myeditor" label ="label text" type="editor" editor="jce" buttons="true" width="450" height="280" hide="article,image" filter="safehtml" description="description text" />


4

Yes, you can make your own options, here is how: <field name="state" type="list" label="JOPTION_SELECT_PUBLISHED" onchange="this.form.submit();"> <option value="">JOPTION_SELECT_PUBLISHED</option> <option value="-2">JTRASHED</option> <option value="0">JUNPUBLISHED</option> <option ...


4

Use filter="png" instead of filter="*.png" (remove *.)


4

Your main module file and template file will have $params variable created by Joomla! core. If you have static methods, then pass that variable to function call: class ModTestHelper { public static function getFoo ($params) { return $notthis; // whatever your return } } $result = ModTestHelper::getFoo($params); But if you want to use OOP:...


4

Yes it is possible to do this: showon="foo!:"


4

The problem is that it is not able to get the field. I see filename you have defined as ulwiz_wmode.php and in class name you are using this JFormFieldUlWiz_WMode. Make sure the naming convention is very proper and should be same as class name and filename. It should be JFormFieldUlwiz_wmode. <?php defined('_JEXEC') or die('Restricted access'); ...


4

Use Form::setFieldAttribute(). Typically, this is done in the model's getForm() method. However, if it's cosmetic only, it can be done in the view too. In /administrator/com_image/models/forms/image.xml (outside of a <fieldset> is fine): <field name="myNote" type="note" class="alert alert-info" /> In /administrator/com_image/views/...


3

If there is no native answer I have a solution to do this with an own JFormRule class. Create a file in your component/models/form/rules directory called regex.php Insert the source below class componentnameFormRuleRegex extends JFormRule { public function test(&$element, $value, $group = null, &$input = null, &$form = null) { $...


3

You can use Client Side Validation for this, however You will need to make a Custom Form Field for this to happen. Assuming you're using Joomla 3.4, you first need to initialise the validation script, like so: JHtml::_('behavior.formvalidator'); Then for your field, you need to add the class validate-changeme <field name="firstname" type="text" label="...


3

Yes this is possible but is a major work around. Joomla has two required verification events. One in he browser and the other on the server just before saving of the form. The browser is the easy part to bridge, the server-side verification is more tricky. I add an extra hidden field called "not_required" to my form and use this to send the fields not ...


3

predefinedlist form field is extending ordinary list field. It allows to create drop downs with predefined options (as name says). Also allowing to add custom options through XML. For example it's used by status, userstate and useractive field types (also not documented). These are mainly used by Joomla! Core extensions. I think that lack of documentation ...


3

If you are using "Chosen" for your selects then you should trigger "Chosen" to update the data: jQuery("#jform_state").append("<option value=Bavaria>Bavaria</option>"); jQuery("#jform_state").trigger("liszt:updated"); The most recent version of "Chosen" uses a slightly different event: trigger("chosen:updated"); But in Joomla 3 (at the moment ...


3

Your concern is justified. Indeed, if there is an SQL error, the backend of the module will crash. If this is a must have for you, I would look into extending the JFormFieldSQL with a custom implementation where you can check for SQL errors or do a MYSQL check like SHOW TABLES LIKE 'mycomponenttable' See How to create a custom form field type in a module?...


3

If you want to use external images for intro or full article image, then you can just paste the image's url in that field. Similarly, if you want to use external image inside your article body, you can use the insert/edit image button of the editor and paste the url of the image in the image source field. However, although possible, it's not a recommended ...


3

Everything you need to get started with JForm for views https://www.ostraining.com/blog/how-tos/development/getting-started-with-jform/


3

When no filter is specified for a calendar field, the system will automatically apply the 'user_utc' filter. According to Joomla!'s documentation, this filter, "calculates the specified value to the time of Greenwich, according to the user time zone settings." In this case, no timezone adjustment was necessary as the date was already in the appropriate ...


3

Have you tried to use Subform field?. It allows you to nest XML forms inside each other or reuse your existing forms inside your current form. And your need, you can combine it with showon attribute.


3

In your table's bind function, add this: if ( ( !empty( $array[ 'list_links_url' ] ) && ( is_array( $array[ 'list_links_url' ] ) ) ) ) { $this->_jsonEncode[] = "list_links_url"; }


Only top voted, non community-wiki answers of a minimum length are eligible