?
avatar piotr-cz
piotr-cz
11 Apr 2015

There's a problem when showon attribute is applied to field inside a group, but target field is not within it.

<fieldset>
     <field
        name="has_full_image"
        type="radio"
    >
        <option value="yes">JYES</option>
        <option value="no">JNO</option>
    </field>
</fieldset>
<fields name="images">
    <field
        name="image_fulltext"
        showon="has_full_image:yes"
    />
</fields>

because the attached rel attribute is generating id from the source field:

<div class="control-group  showon_yes"  rel="showon_jform[images][has_full_image]">
...
</div>

Dirty workaround is to place both field withing same group

avatar piotr-cz piotr-cz - open - 11 Apr 2015
avatar joomla-cms-bot joomla-cms-bot - change - 11 Apr 2015
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 11 Apr 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 11 Apr 2015
Category Libraries
avatar Fedik
Fedik - comment - 18 May 2015

some time ago I had idea change to:

<fieldset>
<fields name="options">
     <field type="radio" >
        <option value="yes">JYES</option>
        <option value="no">JNO</option>
    </field>
</fields>
</fieldset>
<fields name="images">
    <field
        name="image_fulltext"
        showon="options.has_full_image:yes"
    />
</fields>
<div class="control-group"  
  data-showon-field="has_full_image" 
  data-showon-value="yes" 
  data-showon-form-control="showon_jform[options]">
...
</div>

so in script we can take all fields with name [has_full_image] and filter out only the fields that under group showon_jform[options] ... in theory such thing can work on repeatable field also ....
but just a theory :smile:

avatar obsidev
obsidev - comment - 30 May 2015

Hi,

In fact, it is why I was talking about in that thread: #3379 (comment)
And it could be made by a simple modification: 1b30841

Regards,

avatar photodude
photodude - comment - 30 Jun 2015

I have also found showon fails to work in repeatable fields even when all of the references are in the same repeatable grouping. I've included the showon/repeatable failure as a note in issue #6882

@Fedik your "working theory" seems like a better overall implementation than the current "let's add an 'id' to the field rel for showon" implementation (although I think you have some typo's in your example, i.e. field rather than fields, etc). I've been learning more about object oriented programming concepts recently, I wonder what would be the best way to set up things like showon to function with object references to fields rather than as a procedural item increment reference to the fields? To me (with my very limited experience with javascript and javascript objects and connecting those JS objects to PHP and PHP objects) your method makes more sense to me and seems to be closer to an object implementation.

I also wonder if this could be propperly implemented so entire fieldsets could have showon references.

avatar jawadakr
jawadakr - comment - 7 Sep 2015

it seems that its not working with modules on front end as well. however same module fields are working fine with showon attribute.

avatar brianteeman brianteeman - change - 10 Mar 2016
Category Libraries Fields Libraries
avatar brianteeman
brianteeman - comment - 8 May 2016

Hi you created this issue sometime ago but have not provided any code for people to evaluate. As no one else has shown any interest in providing the code and you have not then I am closing this issue at this time. If code is provided (a pull request) it can always be re-examined.


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

avatar brianteeman brianteeman - change - 8 May 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-05-08 13:23:35
Closed_By brianteeman
avatar brianteeman brianteeman - close - 8 May 2016

Add a Comment

Login with GitHub to post a comment