? Success

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
8 May 2014

What here:

  • complete rewritten script
  • fixed multiple instances on the one page
  • fixed rows duplication
  • fixed some fields that stopped work right, after duplication
  • fixed "to big modal" - added scroll
  • each new row will be added after the row where the button "add" was clicked, as alternative for "sortable" :wink:

Links:

XML that I use for testing:

<field name="test" type="repeatable" icon="list"
        label="Test" description="Test descr"
        default=""
        maximum="5">
    <fieldset hidden="true" repeat="true">
        <field name="test_color" type="color" default="#eee"
            label="color"  description="test_color" />

       <field name="test_tag" type="tag"
            label="JTAG" description="test_tag" mode="nested"
            multiple="true" />

        <field name="test_list" type="list" default="1"
            label="test_list" description="test_list" >
            <option value="1">JYES</option>
            <option value="0">JNO</option>
        </field>

        <field name="test_text" type="text"
            label="test_text" description="test_text" />

        <field name="test_textarea" type="textarea"
            label="textarea"  width="100" />

        <field name="test_radio" default="0" type="radio"
            label="test_radio" description="test_radio">
            <option value="1">JYES</option>
            <option value="0">JNO</option>
        </field>

        <field name="test_checkbox1" type="checkbox"
            label="checkbox1" description="test_checkbox1"  />

        <field name="test_checkboxes" type="checkboxes"
            label="checkboxes" description="test_checkboxes" >
            <option value="a">A</option>
            <option value="b">B</option>
            <option value="c">C</option>
            <option value="d">D</option>
        </field>

        <field name="test_media" type="media" directory=""
            label="media" description="test_media"/>

    </fieldset>
</field>

And of course can be used existing, if someone already have.

Who brave enough to make a test? :smirk:

avatar Fedik Fedik - open - 8 May 2014
avatar christianostrem
christianostrem - comment - 8 May 2014

Hi. We can test it. We have code that allready uses repeatable.

avatar Ehrenwert
Ehrenwert - comment - 8 May 2014

Hi Fedik,

I'm referring to another post (#3573) where you were so kind to help me out.

Here is my XML (http://d.pr/n/SWVS) and my screenshot (http://d.pr/i/NAly) As you see the modal is a little bit too small to show some fields of the grouped list. It would be nice of the modal would bit a little bit higher.
As you can also see there is no "cancel and do not save"-button in the modal. If I would like to discard changes only from the repeatable-list I'm not able to do so.

Thanks for your help :-)

avatar Fedik
Fedik - comment - 8 May 2014

ok, I see, looks like chosen.js problem that used for select`s, I think the bigger height will not really help ... I will try check more

About "cancel" I already told, you can "cancel" your form, as you do for any other field :wink:

avatar Ehrenwert
Ehrenwert - comment - 8 May 2014

Hi Fedik,

thanks for your fast response. Wow :+1:

Well, maybe I'm too stupid, but what do you mean with "cancel for any other field"? I would like to leave the modal without saving something, if I do not want to.
How can I do that?

avatar Fedik
Fedik - comment - 8 May 2014

I mean that the main form already has "Save" and "Cancel" buttons that you use for save and cancel actions.

avatar oisvidi
oisvidi - comment - 8 May 2014

Hi!

This change works really well! But it's missing a way to cancel changes. Hitting ESC key also saves changes.

About "cancel" I already told, you can "cancel" your form, as you do for any other field

Then you have to discard any other changes to other items on the page. It works, but if possible a "Cancel" on the modal popup would be great.

avatar Fedik
Fedik - comment - 8 May 2014

Hitting ESC key also saves changes.

it do not save any data until you not click "Save" to submit the form

avatar Ehrenwert
Ehrenwert - comment - 8 May 2014

Then you have to discard any other changes to other items on the page. It works, but if possible a >> "Cancel" on the modal popup would be great

That's what I meant - if I change some fields and edit some values of the repeatable-field, I have to discard all changes.

avatar Fedik
Fedik - comment - 8 May 2014

the repeatable-field it nothing more than just a collection of fields (that you can have in the main form), but in popup :smile:

but I understand what you mean :wink:

avatar Fedik
Fedik - comment - 8 May 2014

about size problem that @Ehrenwert wrote
currently I see only one solution: it disable the chosen.js in modal window,
thoughts?

avatar Fedik Fedik - change - 8 May 2014
The description was changed
Description <p>What here:</p> <ul> <li>complete rewritten script</li> <li>partially changed the field markup</li> <li>fixed multiple instances on the one page</li> <li>fixed rows duplication</li> <li>fixed some fields that stopped work right, after duplication</li> <li>fixed "to big modal" - added scroll</li> <li>each new row will be added after the row where the button "add" was clicked alternative for "sortable" <img class="emoji" title=":wink:" alt=":wink:" src="https://github.global.ssl.fastly.net/images/icons/emoji/wink.png" height="20" width="20" align="absmiddle"> </li> </ul><p>Links:</p> <ul> <li> <a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=33392&amp;start=0">[#33392] Repeatable form fields fix</a>, maybe some other already exist to </li> <li>related on github, that I found <a href="https://github.com/joomla/joomla-cms/issues/3192" class="issue-link" title=" [#30781] Small changes to jForm and jField to allow for repeatable form elements ">#3192</a> <a href="https://github.com/joomla/joomla-cms/issues/3564" class="issue-link" title="[#30781] Repeatable field ">#3564</a> <a href="https://github.com/joomla/joomla-cms/issues/3573" class="issue-link" title="Strange Repeatable-Form-Field behaviour">#3573</a> <a href="https://github.com/joomla/joomla-cms/pull/3214" class="issue-link" title="[#33392] Fix repeatable form field javascript">#3214</a> </li> </ul><p>XML that I use for testing:</p> <div class="highlight highlight-xml"><pre><span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test"</span> <span class="na">type=</span><span class="s">"repeatable"</span> <span class="na">icon=</span><span class="s">"list"</span> <span class="na">label=</span><span class="s">"Test"</span> <span class="na">description=</span><span class="s">"Test descr"</span> <span class="na">default=</span><span class="s">""</span> <span class="na">maximum=</span><span class="s">"5"</span><span class="nt">&gt;</span> <span class="nt">&lt;fieldset</span> <span class="na">hidden=</span><span class="s">"true"</span> <span class="na">repeat=</span><span class="s">"true"</span><span class="nt">&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_color"</span> <span class="na">type=</span><span class="s">"color"</span> <span class="na">default=</span><span class="s">"#eee"</span> <span class="na">label=</span><span class="s">"color"</span> <span class="na">description=</span><span class="s">"test_color"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_tag"</span> <span class="na">type=</span><span class="s">"tag"</span> <span class="na">label=</span><span class="s">"JTAG"</span> <span class="na">description=</span><span class="s">"test_tag"</span> <span class="na">mode=</span><span class="s">"nested"</span> <span class="na">multiple=</span><span class="s">"true"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_list"</span> <span class="na">type=</span><span class="s">"list"</span> <span class="na">default=</span><span class="s">"1"</span> <span class="na">label=</span><span class="s">"test_list"</span> <span class="na">description=</span><span class="s">"test_list"</span> <span class="nt">&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"1"</span><span class="nt">&gt;</span>JYES<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"0"</span><span class="nt">&gt;</span>JNO<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;/field&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_text"</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">label=</span><span class="s">"test_text"</span> <span class="na">description=</span><span class="s">"test_text"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_textarea"</span> <span class="na">type=</span><span class="s">"textarea"</span> <span class="na">label=</span><span class="s">"textarea"</span> <span class="na">width=</span><span class="s">"100"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_radio"</span> <span class="na">default=</span><span class="s">"0"</span> <span class="na">type=</span><span class="s">"radio"</span> <span class="na">label=</span><span class="s">"test_radio"</span> <span class="na">description=</span><span class="s">"test_radio"</span><span class="nt">&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"1"</span><span class="nt">&gt;</span>JYES<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"0"</span><span class="nt">&gt;</span>JNO<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;/field&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_checkbox1"</span> <span class="na">type=</span><span class="s">"checkbox"</span> <span class="na">label=</span><span class="s">"checkbox1"</span> <span class="na">description=</span><span class="s">"test_checkbox1"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_checkboxes"</span> <span class="na">type=</span><span class="s">"checkboxes"</span> <span class="na">label=</span><span class="s">"checkboxes"</span> <span class="na">description=</span><span class="s">"test_checkboxes"</span> <span class="nt">&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"a"</span><span class="nt">&gt;</span>A<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"b"</span><span class="nt">&gt;</span>B<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"c"</span><span class="nt">&gt;</span>C<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"d"</span><span class="nt">&gt;</span>D<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;/field&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_media"</span> <span class="na">type=</span><span class="s">"media"</span> <span class="na">directory=</span><span class="s">""</span> <span class="na">label=</span><span class="s">"media"</span> <span class="na">description=</span><span class="s">"test_media"</span><span class="nt">/&gt;</span> <span class="nt">&lt;/fieldset&gt;</span> <span class="nt">&lt;/field&gt;</span> </pre></div> <p>And of course can be used existing, if someone already have.</p> <p>Who brave enough to make a test? <img class="emoji" title=":smirk:" alt=":smirk:" src="https://github.global.ssl.fastly.net/images/icons/emoji/smirk.png" height="20" width="20" align="absmiddle"></p> <p>What here:</p> <ul> <li>complete rewritten script</li> <li>partially changed the field markup</li> <li>fixed multiple instances on the one page</li> <li>fixed rows duplication</li> <li>fixed some fields that stopped work right, after duplication</li> <li>fixed "to big modal" - added scroll</li> <li>each new row will be added after the row where the button "add" was clicked, as alternative for "sortable" <img class="emoji" title=":wink:" alt=":wink:" src="https://github.global.ssl.fastly.net/images/icons/emoji/wink.png" height="20" width="20" align="absmiddle"> </li> </ul><p>Links:</p> <ul> <li> <a href="http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&amp;tracker_item_id=33392&amp;start=0">[#33392] Repeatable form fields fix</a>, maybe some other already exist to </li> <li>related on github, that I found <a href="https://github.com/joomla/joomla-cms/issues/3192" class="issue-link" title=" [#30781] Small changes to jForm and jField to allow for repeatable form elements ">#3192</a> <a href="https://github.com/joomla/joomla-cms/issues/3564" class="issue-link" title="[#30781] Repeatable field ">#3564</a> <a href="https://github.com/joomla/joomla-cms/issues/3573" class="issue-link" title="Strange Repeatable-Form-Field behaviour">#3573</a> <a href="https://github.com/joomla/joomla-cms/pull/3214" class="issue-link" title="[#33392] Fix repeatable form field javascript">#3214</a> </li> </ul><p>XML that I use for testing:</p> <div class="highlight highlight-xml"><pre><span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test"</span> <span class="na">type=</span><span class="s">"repeatable"</span> <span class="na">icon=</span><span class="s">"list"</span> <span class="na">label=</span><span class="s">"Test"</span> <span class="na">description=</span><span class="s">"Test descr"</span> <span class="na">default=</span><span class="s">""</span> <span class="na">maximum=</span><span class="s">"5"</span><span class="nt">&gt;</span> <span class="nt">&lt;fieldset</span> <span class="na">hidden=</span><span class="s">"true"</span> <span class="na">repeat=</span><span class="s">"true"</span><span class="nt">&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_color"</span> <span class="na">type=</span><span class="s">"color"</span> <span class="na">default=</span><span class="s">"#eee"</span> <span class="na">label=</span><span class="s">"color"</span> <span class="na">description=</span><span class="s">"test_color"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_tag"</span> <span class="na">type=</span><span class="s">"tag"</span> <span class="na">label=</span><span class="s">"JTAG"</span> <span class="na">description=</span><span class="s">"test_tag"</span> <span class="na">mode=</span><span class="s">"nested"</span> <span class="na">multiple=</span><span class="s">"true"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_list"</span> <span class="na">type=</span><span class="s">"list"</span> <span class="na">default=</span><span class="s">"1"</span> <span class="na">label=</span><span class="s">"test_list"</span> <span class="na">description=</span><span class="s">"test_list"</span> <span class="nt">&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"1"</span><span class="nt">&gt;</span>JYES<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"0"</span><span class="nt">&gt;</span>JNO<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;/field&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_text"</span> <span class="na">type=</span><span class="s">"text"</span> <span class="na">label=</span><span class="s">"test_text"</span> <span class="na">description=</span><span class="s">"test_text"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_textarea"</span> <span class="na">type=</span><span class="s">"textarea"</span> <span class="na">label=</span><span class="s">"textarea"</span> <span class="na">width=</span><span class="s">"100"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_radio"</span> <span class="na">default=</span><span class="s">"0"</span> <span class="na">type=</span><span class="s">"radio"</span> <span class="na">label=</span><span class="s">"test_radio"</span> <span class="na">description=</span><span class="s">"test_radio"</span><span class="nt">&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"1"</span><span class="nt">&gt;</span>JYES<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"0"</span><span class="nt">&gt;</span>JNO<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;/field&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_checkbox1"</span> <span class="na">type=</span><span class="s">"checkbox"</span> <span class="na">label=</span><span class="s">"checkbox1"</span> <span class="na">description=</span><span class="s">"test_checkbox1"</span> <span class="nt">/&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_checkboxes"</span> <span class="na">type=</span><span class="s">"checkboxes"</span> <span class="na">label=</span><span class="s">"checkboxes"</span> <span class="na">description=</span><span class="s">"test_checkboxes"</span> <span class="nt">&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"a"</span><span class="nt">&gt;</span>A<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"b"</span><span class="nt">&gt;</span>B<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"c"</span><span class="nt">&gt;</span>C<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"d"</span><span class="nt">&gt;</span>D<span class="nt">&lt;/option&gt;</span> <span class="nt">&lt;/field&gt;</span> <span class="nt">&lt;field</span> <span class="na">name=</span><span class="s">"test_media"</span> <span class="na">type=</span><span class="s">"media"</span> <span class="na">directory=</span><span class="s">""</span> <span class="na">label=</span><span class="s">"media"</span> <span class="na">description=</span><span class="s">"test_media"</span><span class="nt">/&gt;</span> <span class="nt">&lt;/fieldset&gt;</span> <span class="nt">&lt;/field&gt;</span> </pre></div> <p>And of course can be used existing, if someone already have.</p> <p>Who brave enough to make a test? <img class="emoji" title=":smirk:" alt=":smirk:" src="https://github.global.ssl.fastly.net/images/icons/emoji/smirk.png" height="20" width="20" align="absmiddle"></p>
Labels Added: ? ?
avatar Fedik
Fedik - comment - 8 May 2014

ok, so hope size problem now fixed,
also "cancel" button added,
please try test again

avatar Ehrenwert
Ehrenwert - comment - 8 May 2014

Hm, on safari and firefox (both cleared cache and tmp files) the admin-backend looks like this now:

http://d.pr/i/7YYa
http://d.pr/i/n3FK

The top-menu is missing...

But the size-problem is fixed now :-) :+1:

avatar christianostrem
christianostrem - comment - 9 May 2014

Hi. We have tested the repeatable and it dosent work on modules. It seems like it might work when you allready have added data, but if its empty it dosent work.

avatar christianostrem
christianostrem - comment - 9 May 2014

I have tested some more. And repeatable dosen work if it dosent have any data.

avatar Fedik
Fedik - comment - 9 May 2014

@christianostrem thanks for testing,
I will check again, looks like I broke something in last commits, because sure that I tested it with empty value

avatar Fedik
Fedik - comment - 9 May 2014

I just checked and all works good, even with empty value,
@christianostrem have a more details, what exactly not works, maybe some errors in the browser console?
also I cannot reproduce the problem that @Ehrenwert told, @Ehrenwert have a more details, what you did for it? :smile:

avatar christianostrem
christianostrem - comment - 9 May 2014

I know what the problem is. It has to do with backward compability. The old way of creating the xml for the repeatable dosent work when the values are empty.
I change my xml to the code you have written and it works. Btw the code you have written is much better :)

avatar Fedik
Fedik - comment - 9 May 2014

hmm, I tried make it b/c,
can you provide your "old" xml for repeatable? so I can try check more :)

avatar Ehrenwert
Ehrenwert - comment - 9 May 2014

Hi @Fedik
I just copied the files you changed into my joomla-installation.

avatar christianostrem
christianostrem - comment - 9 May 2014
<field name="related_links" type="Repeatable" icon="list" description="" label="Related links" default="{'related_url_internal':[''],'related_url_external':[''],'related_url_external_title':['']}">
                    <fields name="params">
                        <fieldset hidden="true" name="related_links_modal" label="Links" repeat="true">
                            <field name="related_url_internal" type="menuitem" default="45" label="Select a internal menu item" description="" />
                            <field name="related_url_external" type="text" default="" label="Enter external URL" description="" size="10" />
                            <field name="related_url_title" type="text" default="" label="Enter external URL title" description="" size="10" />
                        </fieldset>
                    </fields>
                </field>
avatar Fedik
Fedik - comment - 9 May 2014

@christianostrem it not because empty, it because default value {'related_url_internal':[''],'related_url_external':[''],'related_url_external_title':['']} is not valid JSON string, that used in old version.

In the old version it works because used JSON.decode, that related to moototls, that use eval for JSON parsing :smile:

complicated

avatar Fedik
Fedik - comment - 9 May 2014

now should be good, please try again
@Ehrenwert maybe you missed some file? ;)

avatar Fedik
Fedik - comment - 9 May 2014

"Travis" test for php 5.4 crashes on javascript? :smile:

avatar Ehrenwert
Ehrenwert - comment - 11 May 2014

Works :+1: :)

avatar jrseliga
jrseliga - comment - 10 Jun 2014

Using the editor field type and radio with class="btn-group" don't work.

avatar Fedik
Fedik - comment - 10 Jun 2014

Thanks for testing :wink:

sure, it will not work :smiley:

currently Joomla! have no api for interaction between scripts, so no simple way make "repeatable" editor works ;)
and with the radio with class="btn-group" same problem - it by admin template script (if I understand you right)

Also this means that any field that have additional javascript logic will not work well.

If not count these, all else works good for you?

avatar losedk
losedk - comment - 9 Jul 2014

Nice work @Fedik - The field actually works now :)

It would be awesome if it was possible to sort the rows as well. Perhaps it's possible to use sortablelist.sortable ?

avatar OLSA
OLSA - comment - 25 Jul 2014

@Fedik thank you very much for great job!

But yes it's possible to include javascript logic for some field inside repeatable form, or include custom css or js file, or custom form field type.

Eg. in one my module with repeatable form I have included custom css in this way:

  • create folder tree with php file at the end: my_module/models/fields/style.php
  • inside repeatable form add path to custom form fields
<fieldset hidden="true" repeat="true" addfieldpath="/modules/mod_mymodule/models/fields">
  • next step is to call style field type <field hidden="true" type="style"/> like it is one of our form fields
  • content of style.php file
// style.php
defined('_JEXEC') or die('Restricted access');
jimport('joomla.form.formfield');
$document = JFactory::getDocument();
$document->addStyleSheet(JURI::root(true) .'/modules/mod_mymodule/css/mystyle.css' );
class JFormFieldStyle extends JFormField {
    protected $type = 'style';
    public function getInput() {            
            return;             
    }
}

Also here is some image where style.css helped me to create smaller form.

Completly the same procedure is to call real custom form field type:
eg. this is some "switcher" field

//switcher.php 
jimport('joomla.form.formfield');
$document = JFactory::getDocument();
$document->addScript(JURI::root(true) .'/modules/mod_mymodule/js/mymodule.js');

class JFormFieldSwitcher extends JFormField {

    protected $type = 'switcher';

    public function getInput() {
            return '<select id="'.$this->id.'" name="'.$this->name.'">'.
                   '<option value="1" >By Menu</option>'.
                   '<option value="2" >To Article</option>'.
                   '<option value="3" >Paste URL</option>'.
                   '</select>';
    }
}

After it call it inside repeatable form:

<field one../>

<field two.../>

<field name="switcher" type="switcher" label="Link Type" description=""  />

<field four../>

Best regards and thanks!
Sasha

avatar wilsonge
wilsonge - comment - 27 Jul 2014

@Fedik Fedik,
This is AWESOME!!! thanks!!! 2 comments:

  1. If the form field is a long way down the page the modal opens right at the top of the page. (see #3147 for an example) so it looks initially broken
  2. The new button at the top of the modal in my opinion should add an item to the top of the list. So you can add a item to any position on the list (I don't know if that's what happens at the moment but that's probably what it should do - though not essential for this PR)
avatar Fedik
Fedik - comment - 27 Jul 2014

@wilsonge
1. this should be good here, but not sure that I right understand the problem
2. for me more logical it add the new record at the end of the table :)

question, there another pull joomla-projects/cms-naked#53 , same as this but with layout support, how better to do: close a current pull , and use newest or?

avatar wilsonge
wilsonge - comment - 28 Jul 2014

RE: 1. It's definitely not. Apply your patch and #3147 and look at the form field and where the modal opens. It's a fairly big bug

I'd do this first - let's get the form field working. Then we can improve the form fields with JLayouts in the other repo at a later point. Me and Roberto need to focus on that again soon

avatar losedk
losedk - comment - 28 Jul 2014

@Fedik regarding #3147 - The modal opens in the top, forcing scroll on the user to see the repeatable field

skrmbillede-2014-07-28-kl -18 09 02

avatar wilsonge
wilsonge - comment - 28 Jul 2014

Thanks for the screenshots :) was going to do that this evening!

On 28 July 2014 17:12, Peter Lose notifications@github.com wrote:

@Fedik https://github.com/Fedik regadring #3147
#3147 - The modal opens in the
top, forcing scroll on the user to see the repeatable field

[image: skrmbillede-2014-07-28-kl -18 09 02]
https://cloud.githubusercontent.com/assets/1738811/3723275/c1f8fb36-1671-11e4-8c32-36a460a3e11f.jpg


Reply to this email directly or view it on GitHub
#3574 (comment).

avatar Fedik
Fedik - comment - 29 Jul 2014

hm, strange,
but ok, I will try check after return from vacation :wink:

avatar joomla-agency
joomla-agency - comment - 11 Aug 2014

Tested this in my own template with Joomla 3.3.3. Works better and this bugs are gone:

  • Add Button works excepted (ordering)
  • Cancel button Bug solved (duplicate table entries after press)
  • Multiple instances on same page works
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels Removed: ?
avatar Fedik
Fedik - comment - 25 Aug 2014

@wilsonge @losedk please try test again :wink:

avatar wilsonge
wilsonge - comment - 25 Aug 2014

Looks awesome. You can see travis is failing because of code style now :P You just need to go fix that and I think this can be merged in!

avatar losedk
losedk - comment - 25 Aug 2014

@Fedik All good :+1:

d7269bd 25 Aug 2014 avatar Fedik c.s.
avatar Fedik
Fedik - comment - 25 Aug 2014

done :smile:

avatar losedk
losedk - comment - 27 Aug 2014

should we mark this as RTC?

avatar joomla-agency
joomla-agency - comment - 28 Aug 2014

It's possible implement "Drag and Drop" reorder to this - like Joomla?

avatar zero-24 zero-24 - change - 28 Aug 2014
The description was changed
Status New Ready to Commit
avatar Bakual Bakual - change - 31 Aug 2014
The description was changed
Status Ready to Commit New
Labels Added: ?
avatar Bakual Bakual - reference | - 31 Aug 14
avatar Bakual
Bakual - comment - 31 Aug 2014

Merged into the 3.4-dev branch. Thanks!

avatar Bakual Bakual - change - 31 Aug 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-08-31 18:46:18
avatar Bakual Bakual - close - 31 Aug 2014
avatar Bakual Bakual - close - 31 Aug 2014
avatar persohub
persohub - comment - 21 Nov 2014

I needed to process repeated textareas containing raw data (html). So simply applying filter="raw" to the textarea field did not work, as the value gets wrapped into the hidden data container.
After some investigation I found applying the filter="raw" to the Repeatable element did the trick.
I have also tried to append the filter to the Repeatable element during the process of creating the attached fields, but without luck...
From my opinion, the Repeatable element should inherit the filter from its children for a more convenient use.

avatar Fedik Fedik - head_ref_deleted - 21 Nov 2014
avatar m4ucoder
m4ucoder - comment - 30 Nov 2014

Hello I have modified the core code for : repeatable.php and repeatable.js
This script works for me :

  • corected bugs of former version :
    -> it was not possible to have many JFormFieldRepeatable into a same form
    -> the list was incremented unexpectly when clicking on "save" and re-opening

  • additionnal fieldType :
    -> modal field (like JFieldUser...) can be added
    -> chozen select works

  • todo :
    -> no validation for the repeated fields, (no time for the moment)

I have modified the code because I really need modals, and "chosen" selects. Surelly the code must be perfectible, but for me this is the way to have something working.

I hope this help somebody : Your text to link here...

best regards

Philippe

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

avatar motamedimasoud
motamedimasoud - comment - 26 Jan 2015

FEDIK Please Help me man please...I have problem with field type media in repeatable..when i use this i choose for example one pic when i want to save or cancell that page doesnt do anything..how can i fixed that its make me old plaeas help me

avatar losedk
losedk - comment - 26 Jan 2015

@motamedimasoud Could you provide your xml code?

avatar Fedik
Fedik - comment - 26 Jan 2015

@motamedimasoud do backup of your site, then download and replace to new files:
libraries/joomla/form/fields/repeatable.php
media/system/js/repeatable.js
media/system/js/repeatable-uncompressed.js

in theory should help :smile:

avatar motamedimasoud
motamedimasoud - comment - 26 Jan 2015

FEDIK THANK U ALOT I LOVE U SO MUCHHHHHHHHHHHHHHHHH IT WORKED THANK U I WANT TO KEEP IN TOUCH WITH U PLEASE GIVE ME YOURM EMAIL ADDRESS I NEED U MY EMAIL ADDRESS IS MOTAMEDI_MASOUD@YAHOO.COM PLZ SEND ME AN EMAIL THANK U AGAIN MAN

avatar jrseliga
jrseliga - comment - 15 Feb 2015

The format of the JSON stored from a repeatable seems counter intuitive. Take for example:

repeatable

It stores the following JSON string.

{
    "title":
        ["Beach","Mountains"],
    "caption":
        ["Sun","Snow"],
    "link":
        ["Home","Home"],
    "image":
        ["beach.jpg","mountains.jpg"]
}

That data structure isn't representative of the input from the user.

A structure similar to the one below is a better representation. Each value is associated with a row in the repeatable, and is also more friendly to decoding into an array for iterative purposes.

"0":
    {
        "title": "Beach",
        "caption": "Sun",
        "link": "Home",
        "image": "beach.jpg"
    },
"1":    
    {
        "title": "Mountains",
        "caption": "Snow",
        "link": "Home",
        "image": "mountains.jpg"
    }
avatar OLSA
OLSA - comment - 15 Feb 2015

Hello for all.
I respect all your hard works with Joomla repeatable form fields, but I use different approach to get same things (no other popups inside main popup etc...)...
More about my Multipler module at: http://olsa.me/joomla-extensions/3-repeatable-section-module

Sorry @Fedik because I write about it here, but if it is interesting I will create repository for that.

Thanks and regards for all.

avatar rdeutz rdeutz - change - 16 Feb 2015
Milestone Added:
avatar wilsonge
wilsonge - comment - 12 Mar 2015

@jrseliga I agree with this - the problem is that we just can't do this for the form field anymore because of b/c. Users who are using this field (yes there are some poor poor people who tried it before this patch) now expect the current data structure. And it's not even like we can find all the database tables currently using this structure and alter them either.... :( It would need a 'new' form field.

avatar jrseliga
jrseliga - comment - 12 Mar 2015

@wilsonge I don't know the process of deprecating code, it seems to me that it would be wise to create that "new" form field (repeatable2 or something) that addresses this issue. Mark the current as deprecated and remove it for a future 3.x or the 4.0 release. I would argue that the current JSON format approaches unusable, if nothing else it requires some ugly code once decoded into "usable" PHP arrays.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 13 Mar 2015

It may not require a new field type. Maybe you just need an attribute in the on the <field> tag to specify which format you want to save as.

Add a Comment

Login with GitHub to post a comment