? ? Pending

User tests: Successful: Unsuccessful:

avatar rdeutz
rdeutz
12 May 2017

Pull Request for Issue #15977

Summary of Changes

Added a condition to cover a use case that was possible before 3.7.0. It is wasting time to discuss if this is a use case that was intended, I think it wasn't. Anyway this patch with allow the use case.

Testing Instructions

Preparations

We can do JFormObject manipulations in the template, this is easier for testing. So in a vanilla Joomla installation:

  1. Go to the template folder of protostar and create a directory html/com_users/remind
  2. Copy the default.php file form components/com_users/views/remind/tmpl/ to the directory created.
  3. Change the file components/com_users/models/form/remind.xml so that it contains the following content:
<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="custom_fields" />
</form>

Tests

  • Add the following code to the default.php in html/com_users/remind (template)
// create and add a field
$form = $this->form;

$xml = '<field type="text" name="test-field" label="Test field" />';
$form->setField(new \simpleXmlElement($xml), 'custom_fields');

echo "#<div style='text-align:left;font_size:1.2em;'><pre>";
print_r($form->getField('test-field', 'custom_fields'));
echo "</pre></div>#";
  • Go to the front page and click on "Forgot your username?"

Without Patch

You don't see output for the field internals

With Patch

You see output for the field internals

Don't expect to see the field in the form, that's not the way forms have to be defined so that the output can be dynamically created.

avatar rdeutz rdeutz - open - 12 May 2017
avatar rdeutz rdeutz - change - 12 May 2017
Status New Pending
avatar rdeutz rdeutz - edited - 12 May 2017
avatar joomla-cms-bot joomla-cms-bot - change - 12 May 2017
Category Libraries
5b17146 12 May 2017 avatar wilsonge :(
avatar wilsonge wilsonge - change - 12 May 2017
Title
Allow to set a field with fields without fieldset
Allow to set a field within fields without fieldset
Labels Added: ?
avatar phproberto
phproberto - comment - 12 May 2017

Thanks for the patch. I will test it as soon as possible.

avatar wilsonge
wilsonge - comment - 12 May 2017

If you can get it done by this evening we can squeeze it into the 3.7.1 release next week :) (Release Candidate cutoff is 5.30pm GMT this evening)

avatar infograf768
infograf768 - comment - 12 May 2017

After patch I get

JFormFieldText Object
(
    [type:protected] => Text
    [maxLength:protected] => 0
    [inputmode:protected] => 
    [dirname:protected] => 
    [layout:protected] => joomla.form.field.text
    [description:protected] => 
    [hint:protected] => 
    [autocomplete:protected] => on
    [spellcheck:protected] => 1
    [autofocus:protected] => 
    [element:protected] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [type] => text
                    [name] => test-field
                    [label] => Test field
                )

        )

    [form:protected] => JForm Object
        (
            [data:protected] => Joomla\Registry\Registry Object
                (
                    [data:protected] => stdClass Object
                        (
                        )

                    [initialized:protected] => 
                    [separator] => .
                )

            [errors:protected] => Array
                (
                )

            [name:protected] => com_users.remind
            [options:protected] => Array
                (
                    [control] => jform
                )

            [xml:protected] => SimpleXMLElement Object
                (
                    [fields] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [name] => custom_fields
                                )

                            [field] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [type] => text
                                            [name] => test-field
                                            [label] => Test field
                                        )

                                )

                        )

                )

            [repeat] => 
        )

    [formControl:protected] => jform
    [hidden:protected] => 
    [translateLabel:protected] => 1
    [translateDescription:protected] => 1
    [translateHint:protected] => 1
    [id:protected] => jform_custom_fields_test_field
    [input:protected] => 
    [label:protected] => 
    [multiple:protected] => 
    [repeat] => 
    [pattern:protected] => 
    [name:protected] => jform[custom_fields][test-field]
    [fieldname:protected] => test-field
    [group:protected] => custom_fields
    [required:protected] => 
    [disabled:protected] => 
    [readonly:protected] => 
    [validate:protected] => 
    [value:protected] => 
    [default:protected] => 
    [size:protected] => 0
    [class:protected] => 
    [labelclass:protected] => 
    [onchange:protected] => 
    [onclick:protected] => 
    [showon:protected] => 
    [renderLayout:protected] => joomla.form.renderfield
    [renderLabelLayout:protected] => joomla.form.renderlabel
)

Is that succesful?

avatar rdeutz
rdeutz - comment - 12 May 2017

yes, the following part is important

[fields] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [name] => custom_fields
                                )

                            [field] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [type] => text
                                            [name] => test-field
                                            [label] => Test field
                                        )

                                )

                        )
avatar infograf768
infograf768 - comment - 12 May 2017

I have tested this item successfully on 5b17146


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15981.

avatar infograf768 infograf768 - test_item - 12 May 2017 - Tested successfully
avatar dgt41
dgt41 - comment - 12 May 2017

I have tested this item successfully on 5b17146


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15981.

avatar dgt41 dgt41 - test_item - 12 May 2017 - Tested successfully
avatar dgt41 dgt41 - change - 12 May 2017
Status Pending Ready to Commit
avatar dgt41
dgt41 - comment - 12 May 2017

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/15981.

avatar wilsonge wilsonge - change - 12 May 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-05-12 16:01:48
Closed_By wilsonge
Labels Added: ?
avatar wilsonge wilsonge - close - 12 May 2017
avatar wilsonge wilsonge - merge - 12 May 2017

Add a Comment

Login with GitHub to post a comment