Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [jform]

Form Class for the Joomla Platform.

Filter by
Sorted by
Tagged with
10
votes
1answer
6k views

What are possible filters in Joomla form fields?

I see intermittent use of filter="safehtml" and filter="string" throught Joomla forms. Is there a complete list, and can custom filters be created?
10
votes
1answer
2k views

How can I dynamically generate a form's XML from PHP?

I have a requirement to generate a page/form based on the user's list of items. As is, the user can specify a list of items that have a text description of the item, and whether it's a text or list ...
9
votes
2answers
1k views

How can I override the class or readonly attribute that is specified in the form xml?

We have a particular field that can only allow input when adding the record for the first time, so I'm wondering if it is possible to add a class, or specify readonly at some point after the form has ...
7
votes
2answers
1k views

How can I provide a custom message for a failed JFormRule validation?

When validating a custom field, and the test fails, Joomla returns the following default error message: **Warning** Invalid field: My Field How can I specify the message that is returned to explain ...
6
votes
1answer
686 views

Custom XML attributes not showing in HTML markup

Here is the XML for a particular form field: <field type="text" name="first-name" id="first-name" label="MOD_LABEL_FIRST_NAME" required="required" maxlength="27" color="yellow" /> My ...
5
votes
4answers
5k views

How to work with field type Checkboxes (not checkbox)

My component needs to save mulitple options, and I can't seem to get my head wrapped around how to do it. Referring to Checkboxes form field type, I'm not sure how Joomla is expecting to save the ...
5
votes
2answers
2k views

How to use a custom layout with JForm subform fields?

I want to reuse some forms in my component. The subform field does the job. However, I need to remove some fields and/or field groups when displaying the subform. I tried to use the JForm methods ...
5
votes
1answer
2k views

How to show a search box inside a list form field

How to show a search box inside a 'list' type of form field?
5
votes
1answer
2k views

Server-side validation rule is not being found

I've added a custom field to com_content, and everything has been working wonderfully. I'm now trying to add some server side validation, and after following all the tutorials and examples I've been ...
4
votes
3answers
10k views

How to get module parameters inside helper function and how to get params inside a custom form field type?

Part 1: How to get module parameters inside helper function? I am trying to get the same module parameters inside the helper file. class ModTestHelper { public function getFoo () { ...
4
votes
1answer
3k views

How to retrieve values of all the fields with JInput but without jform[]

As we know we can retrieve values of all the fields if they have names like name="jform[something]" and we can use the code: $jinput = JFactory::getApplication()->input; $formData = new JRegistry($...
4
votes
2answers
969 views

Building Component - Replace “Invalid Field: My Field” with Custom Message

I am developing Custom Component for Joomla. I did well in validating field by adding custom rule. But if entered value does not pass through my validation, it gives error as "Invalid Field: My Field ...
4
votes
1answer
2k views

Writing custom method to save form data

I am trying to find the preferred way to save form data using joomla API methods. I am trying to save data with an ajax-call. First i tried just calling the components standard save method, calling: ...
4
votes
3answers
2k views

JForm::setField/s - Add field to fieldset

So I'm trying to get my head around the creation of fields on the fly using JForm::setField. But as usual there is no documentation explaining how to use this method only the very minimal API ...
4
votes
3answers
938 views

How to save data from 2 fields as a JSON string to 1 database table field?

I need help to store data in json format in my DB like {name:'1', name2:'2'}. So far I have this: model/form/category.xml: <fieldset> <field name="name" type="text" ...
4
votes
3answers
946 views

checkboxes field type in module settings not checked by default

I want to add following form field in module settings like - <field name="fb_posttype" type="checkboxes" label="Post types"> <option value="status" >Statuses</option> ...
3
votes
3answers
3k views

Filtering list of Users in User form field type

I've been unable to determine if/how the list of users can be filtered. The example below from User form field type, shows the filter in use, but I've been unable to come up with how to specify the ...
3
votes
3answers
2k views

Overriding Core Components Model Form XML

I want to change the Field type for the Article's Links, from input text to DropDown List with internal menu items. I am looking for a convenient way to do this with the minimum work. I can't find ...
3
votes
2answers
565 views

Adding Custom Fields to Article Component [Not in attribs field]

I am trying to save some additional fields into the Article Content and there has been a few questions like this relating to this issue but all of the solutions seem to point to saving the extra field ...
3
votes
1answer
2k views

How to style a Custom Field radio list as btn-group?

I'm trying to create a custom field which is a radio list, and must be displayed as a btn group. It works as expected when using the standard type="radio"in the XML (rating2), but when rendered as a ...
3
votes
4answers
3k views

JForm in modal window

I create a modal window when clicking on a custom toolbar button, like I was explained here and now the doubt I have is on how to create the JForm for this modal window, because they should submit ...
3
votes
1answer
604 views

How to add jQuery functionality in the backend of a module?

I'm making a module where the user can select some manufacturers names from the backend and the names will be posted in the index with some nice css. I want to ask if I can add some jquery in the ...
3
votes
1answer
2k views

How to get the form of component from module?

I tried to get a component form from my module. I got the model and then tried to get the form, but the result was empty. I tried to define 'JPATH_COMPONENT' and it was useless. define('...
3
votes
1answer
472 views

How to retrieve active filter from a custom field form?

Having followed the excellent explanation for How to create a view with filters and pagination, I have a custom field that filters for the most part. As it is, the code in the custom field is ...
3
votes
1answer
918 views

Store multiple form fields as JSON string

I'm trying to store multiple field values in a JSON string in my component but I'm not quite sure how to go about it. I've done some research and it seems that using the load and bind JTable methods ...
3
votes
4answers
865 views

How to retrieve unique values before a parenthesis in JFormFieldList Filter query?

I have a JHtml custom filter populated by a JFormField extended class. It is added in the view with the following code: JHtmlSidebar::addFilter( '- Select Height -', 'filter_height', ...
3
votes
1answer
630 views

How to select predefined options in an custom form list-field?

I'm trying to pre-select several options in a custom form field. I created a new JFormField which extends JFormFieldList and gets its values from my database. This is my current code: protected ...
3
votes
1answer
87 views

Joomla - PHP+$this wrapped in Javascript.

Here is script I have. I'm trying to load it after page display. I'm trying to execute PHP code from javascript. What I need is to get email address of user who submitted the form at the textbox ...
3
votes
2answers
447 views

Save Dynamic Array of textboxes

I have developed a code to create dynamic textboxes on click of "Add" button using javascript - Javascript function GetDynamicTextBox(value,index) { return '<input type="text" name="...
3
votes
1answer
878 views

How to bookmark articles to user profile?

We are developing a Joomla site where different types of articles will be posted and the users will bookmark the article to their user account and display it in their user profile. If there is a ...
3
votes
1answer
39 views

Creating a multidimensional JForm field dynamicaly

Item Model protected function preprocessForm(JForm $form, $data, $group = 'examplegroup') { foreach ($data as $i => $item) { $field = new \SimpleXMLElement('<field />'); $...
3
votes
2answers
485 views

Passing Arguments for custom field

I need a custom field which has to select the database with some conditions. When customer A logged in this field has to select records belong to customer A only. The custom field is as below ...
3
votes
1answer
150 views

JFormFieldRepeatable—can store only one row

I am trying to use the »repeatable« form field. Right now I have this in code in the templateDetails.xml <config> <fields name="params"> <fieldset name="advanced"> ...
2
votes
1answer
2k views

Load a Single Admin view with multiple tables and forms

We have 2 tables that have data and we need to bring data from both the tables and show in one single view. We have one single XML file which holds the fields of both the tables. The function '...
2
votes
2answers
1k views

Array of form fields

I am trying to load a array of form fields as below. grade.xml <field name="gralev_code[]" type="text" class="width20" label="JSCH_GRALEV_CODE" /> default.php $this->form->...
2
votes
2answers
1k views

How to access a specific fieldset in a form in my model class?

I am using the code below for getting form values: $data = JFactory::getApplication()->input->get('jform', array(), 'array'); However, when I use json_encode, it encodes all the form fields I ...
2
votes
1answer
283 views

Joomla 3 Flexicontent custom form based on jForm

After hours of googling and experimenting, I gave up :( I need to add form to my articles in Joomla 3, that collects data from article's additional fields and emails them. Articles are managed by ...
2
votes
3answers
274 views

Filter does not work after clicking grid.published-button

I created a filter for the backend of my component like this: <field name = "category_id" type = "category" label = "JOPTION_FILTER_CATEGORY" ...
2
votes
2answers
1k views

How do I remove and/or change the 'name' field in the registration form so that I can ask for first and last name separately?

I've developed a plugin that allows me to create a custom user profile. It works and I'm able to add/remove fields as necessary. The issue I'm facing is: How do I remove and/or change the 'name' ...
2
votes
1answer
923 views

Set New XML attribute in custom JFormField

Hi I'm looking to add new field attribute for my custom component. <field type="myfield" mycustomattribute="somevalue" /> Then, I would like to render it in my HTML. Could someone help with it?...
2
votes
1answer
2k views

Loading the options of a select form field via jQuery Ajax

Basically I am trying to load a front-end form select field via jQuery AJAX. The XML form field is <field name="student_ids" type="list" required="true" label="Select Students" multiple="...
2
votes
1answer
835 views

Using JHtml::_('behavior.formvalidator') in JForm gives empty error messages

I'm using Joomla! 3.4 core form validation and it seems to fire perfectly, but the error messages added to the alert are blank, hence I cannot see what the error is. What am I doing wrong? Here is ...
2
votes
3answers
1k views

Height and Width are not considered for an editor Form Field

The XML code I have for the editor form field as <field name="note_desc" type="editor" filter="safehtml" label="Description" required="true" height="150" /> Irrespective of the ...
2
votes
1answer
540 views

How to get the JformFieldList Value by ID

I created a custom field as below class JFormFieldPaddyStatus extends JFormFieldList { protected $type = 'paddystatus'; public function getOptions($id='') { $options = array(); $...
2
votes
1answer
1k views

Frontend: why some fields are not in the $data param of the save function?

I'm using a frontend JForm to manipulate some data. The html form is correct, but when it is sent back to the model save function I don't receive all data. This is the data that save receives through ...
2
votes
1answer
30 views

TypeError: Form is Null on Button in Admin toolbar

I am receiving TypeError: form is null in the browser console when I select a custom button added to a form using JToolbarHelper. I can insert the button to any other component as is and it will ...
2
votes
1answer
577 views

Is it possible to render the same fieldset multiple times?

I'd like to render the same fieldset multiple times for batch create and batch update. Is it possible to do this with JForms? Currently I have a form like this: <?xml version="1.0" encoding="UTF-...
2
votes
1answer
724 views

Render field type in custom form

I'm trying to render the media manager field type in a custom form. The form is not loaded from the xml. this code is causing an error: $obj = new JFormFieldMedia(); $obj -> __set('name','...
2
votes
1answer
1k views

AJAX Custom Component - Post data from Editor field

I'm struggling to post data from "editor" form field. When I do it without ajax it shows the value while, with AJAX it just make it blank. Array ( [subject] => asdasdasdasd [description] => [...
2
votes
1answer
248 views

Joomla list formfield stays empty on runtime load

I face the problem, that I have list formfield, where no values have been set in the xml formfield description. The values for the listfield will be created on runtime via jquery. When I choose a ...