?
Referenced as Pull Request for: # 9659
avatar OctavianC
OctavianC
25 Mar 2016

Steps to reproduce the issue

There are two ways to reproduce this:

  • Switch to the Hathor template. I know it's out of date and never updated, but it serves this point for now. Go to Content > Articles > Add New Article. Click on the User icon next to the Created By field. The Modal window shows up (it should be based on MooTools). Click on any user in there and nothing happens.
  • I've also noticed that both Protostar and Isis have layout overrides in /html/layouts/joomla/form/field/user.php. I do understand that they need overrides to use Bootstrap, but if I remove them I would expect them unstyled but functional. Removing overrides and re-doing the steps above will exhibit the same error. #### Expected result

Clicking on a user should close the modal window and assign the user to the hidden field.

Actual result

Clicking on a user does nothing.

System information (as much as possible)

Joomla! 3.5.0 Stable [ Unicorn ] 21-March-2016 22:00 GMT

Additional comments

Seems to be caused by #5655
I've noticed this part https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/form/field/user.php#L50 that seems strange to me:

. ($required ? 1 : 0) . '&field={field-user-id}'

I'm guessing replacing it with:

. ($required ? 1 : 0) . '&field=' . htmlspecialchars($id, ENT_COMPAT, 'UTF-8')

Would do the trick. But I'm not sure if I'm missing something.

avatar OctavianC OctavianC - open - 25 Mar 2016
avatar brianteeman brianteeman - change - 25 Mar 2016
Category Fields Layout
avatar brianteeman brianteeman - change - 25 Mar 2016
Labels Added: ?
avatar wilsonge
wilsonge - comment - 26 Mar 2016
avatar OctavianC
OctavianC - comment - 29 Mar 2016

I'm not sure how jSelectUser is supposed to be triggered by MooTools modals since the function is not called onclick in administrator/components/com_users/views/users/tmpl/modal.php.

I did some tests and can try a PR, but I'm not sure if I entirely understand the point of fielduser.js - it will only inject the click event in Bootstrap modals.

TLDR: My 2 cents: inject the onclick event on page load so it works across all modals and call jSelectUser() because why not, since it does what it's supposed to.

avatar dgt41
dgt41 - comment - 30 Mar 2016

@OctavianC The main difference between the mootools code and the bootstrap is that the later will allow to initialise fields dynamically (this was a prerequisite for the next version of repeatable forms), so in that sense the id is kinda irrelevant where the mootools script (and that kept for B/C) expects the id to be unique etc...

Few of the aims for all the fields should be:

  • to make them repeatable friendly,
  • discard the inline scripts
  • use data attributes
  • use native javascript where possible
avatar brianteeman brianteeman - close - 30 Mar 2016
avatar brianteeman brianteeman - change - 30 Mar 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-03-30 09:20:29
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 30 Mar 2016

Closed as we have a PR #9659 for testing


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

avatar brianteeman brianteeman - close - 30 Mar 2016
avatar molszews
molszews - comment - 26 Jul 2016

After upgrading to 3.6.0 selecting users in external components seems to be broken. Clicking on one in e.g. Akeeba Subscription causes following error in console: window.parent.jSelectUser is not a function
After adding following line
JHtml::script('jui/fielduser.min.js', false, true, false, false, true);
there is no error in console, but clicking on name still gives no effect in that particular component.

Does changes made in 3.5.0 require components to be adjusted in order to work with forms, specifically user selection?


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

avatar marclight
marclight - comment - 8 Nov 2016

@molszews were you able to find a fix? I have the same problem.

avatar dgt41
dgt41 - comment - 8 Nov 2016

@marclight update to 3.6.4

avatar marclight
marclight - comment - 8 Nov 2016

@dgt41 I'm at 3.6.4 and I'm having the same problem as @molszews with Akeeba Subscriptions

avatar brianteeman
brianteeman - comment - 8 Nov 2016

Have you asked akeeba for support?

avatar marclight
marclight - comment - 8 Nov 2016

@brianteeman I wish, they don't support Akeeba Subscriptions anymore. Google sent me here because of what @molszews posted. Was hoping he might got it working.

avatar dgt41
dgt41 - comment - 8 Nov 2016

@marclight do you have the code from #10791 to your site?

avatar molszews
molszews - comment - 9 Nov 2016

@marclight still no luck

avatar OctavianC
OctavianC - comment - 9 Nov 2016

This is not an issue with Joomla! - I've debugged the code and found that Akeeba Subscriptions does not use the JFormFieldUser field - it uses its own HTML, so that's why it isn't working.

avatar marclight
marclight - comment - 9 Nov 2016

@OctavianC THanks for the info.

@molszews I'll put a dev on it and if we make it work, I'll let you know.

avatar OctavianC
OctavianC - comment - 9 Nov 2016

Workaround:
Open /administrator/components/com_akeebasubs/views/user/tmpl/form.php
After:

<script type="text/javascript">

Add:

function jSelectUser(element)
{
    jSelectUser_userid(jQuery(element).data('user-value'), jQuery(element).data('user-name'));
}
avatar marclight
marclight - comment - 9 Nov 2016

@OctavianC I still get the following:

Uncaught TypeError: window.parent.jSelectUser is not a function at HTMLAnchorElement.onclick

avatar OctavianC
OctavianC - comment - 9 Nov 2016

Just tested it and it works, perhaps you need to add it in another view that uses modals (found multiple - user, subscription, coupon etc). Sorry, we're going off-topic.

avatar marclight
marclight - comment - 9 Nov 2016

@OctavianC Added the function in all the views and it now works! Thanks a million ans sorry too for going off topic :)

avatar zero-24 zero-24 - locked - 9 Nov 16

Add a Comment

Login with GitHub to post a comment