Questions tagged [jform]
Form Class for the Joomla Platform.
126
questions
16
votes
1
answer
9k
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
1
answer
3k
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
2
answers
2k
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
2
answers
2k
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
3
answers
13k
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 () {
return $...
6
votes
2
answers
3k
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 ...
6
votes
1
answer
819
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
4
answers
6k
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
1
answer
3k
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
1
answer
3k
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 ...
5
votes
3
answers
2k
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
1
answer
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
2
answers
1k
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
1
answer
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
3
answers
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
3
answers
1k
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
3
answers
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
3
answers
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
3
answers
366
views
Dynamically removing single JForm option
I'm working on a small component and depending on $someoption I need to remove a certain option from the JForm. So for example if $someoption == 1 then I need to remove this option <option value="1"...
3
votes
2
answers
615
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
1
answer
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 '...
3
votes
1
answer
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
4
answers
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
1
answer
826
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
1
answer
3k
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
1
answer
588
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
1
answer
1k
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
4
answers
1k
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
1
answer
1k
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
1
answer
90
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
2
answers
501
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
1
answer
1k
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
1
answer
423
views
Joomla 4 addfieldpath
Has the addfieldpath parameter in custom extension forms changed in Joomla 4? The Joomla admin is no longer finding my component's customized field types.
I'm using addfieldpath="/administrator/...
3
votes
1
answer
68
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
2
answers
671
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
1
answer
152
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
1
answer
924
views
JForm showon attribute does not work in admin site
I have a form field which needs to be shown depending on value selected for another field. For example
<field name="field1" type="list" label="LABEL1" description="DESC1" filter="intval" size="1" ...
2
votes
2
answers
1k
views
Custom 'dynamic' form field creation
I tried to look around, but didn't exactly found what I was looking for. Joomla have documentation about how to create custom form fields. That was useful, but what I need is (I guess simple..?).
I ...
2
votes
2
answers
2k
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
2
answers
2k
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
2
answers
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
1
answer
312
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
1
answer
2k
views
Manually render filter form fields in layout
I am using the searchtools filters in the front end of a custom component.
So I am displaying the fields in my template :
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('...
2
votes
3
answers
410
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
1
answer
1k
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
1
answer
279
views
custom form list field add disabled options - create optgroups
I have a working list based on an sql query. Now I would like to add some spacers (not selectable items).
When doing this manually in xml you can add the disabled attr to that item, but how can I do ...
2
votes
1
answer
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
1
answer
1k
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
3
answers
2k
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
1
answer
607
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();
$...