1

I'm changing user profile plugin in Joomla 3.3, using method described in http://www.inmotionhosting.com/support/edu/joomla-25/user-profile tutorial. Everything works and OK.

But I want to make some changes in profile. In this profile plugin there are two xml files, One for administrator controlling what will appear in registration and profile editing forms, and the second one for the registration (profile editing) form itself.

showon feature works good in the first xml file, but does nothing in second file.

Any ideas about reason and solution ?


@Lodder. I want to add some fields on user profile, based on previous field value. for example if the user is teacher, it brings up course field, if is a student instead brings up classNo. field. So inside plugin profile5 , I changed two files. first one "./plugins/user/profile5/profile5.xml", which is responsible for administration of this plugin. In this file I have added following lines where showon works as expected.

<extension ....>
<name>...</name>
....
...
<config>
<fields name = "params">
<fieldset name = "basic" >
<field> ... </field>
<field> ... </field>
<field> ... </field>
.....

            ***<field name="register-require_dpost" type="list"
                    description="If you are a student or teacher, enter it here."
                    label="Your post student or teacher"
            >
                    <option value="2">JOPTION_REQUIRED</option>
                    <option value="1">JOPTION_OPTIONAL</option>
                    <option value="0">JDISABLED</option>
            </field>

            <field name="register-require_dclass" type="list"
                    description="If you are a student, enter your class here."
                    label="Your class"
                    showon="register-require_dpost:1,2"
            >
                    <option value="2">JOPTION_REQUIRED</option>
                    <option value="1">JOPTION_OPTIONAL</option>
                    <option value="0">JDISABLED</option>
            </field>***
....
....

The second file I have edited is "./plugins/user/profile5/profiles/profile.xml" here I also added two fields where second one should rise conditionally, but it does not do what expected.

<form>
<fields..>
<fieldset...>
<field.../> 
<field.../> 
<field.../> 
....

        ***<field
                name="dpost"
                type="radio"
                id="dpost"
                description="Enter your post here"
                filter="string"
                label="Your post"
                message="PLG_USER_PROFILE_FIELD_WEB_SITE_MESSAGE"
                size="30">
                <option value="1">Teacher</option>
                <option value="2">Student</option>

        </field>
        <field 
            name="dclass"
            type="list"
            showon="dpost:1"
            >
                <option value="501">501</option>
                <option value="502">502</option>
                <option value="503">503</option>
                <option value="504">504</option>
                <option value="505">505</option>

            </field>***

So the problem is about performance of showon in xml file. Is there something in backend which is not present in frontend? Or maybe I'm doing something wrong.

4
  • Welcome to Joomla Stack Exchange. Could you please explain exactly what you're trying to change along with the code you're using?
    – Lodder
    Jan 24 '15 at 18:14
  • From where did you get showon attribute? It is not in the core. Jan 26 '15 at 7:33
  • I have the same problem here : showon does not seem to work in XML files used in front-end. Did you find any solution Hamlet Kraskian ?
    – Emilien
    Feb 19 '15 at 10:55
2

As answered by Joomla Dév Team on Github, showon is not working on XML files related to user profile, because they don't use a regular JForm.

As far as I know, it seems that showon is not working at all on front-end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.