I use DataObjectManger to edit Members. This works well except for one thing. In the editor popup I see both the fields for setting/changing the password and the link that says "Change Password". Normally the password fields would not be visible until that link is clicked. This will be confusing to the end users of the system I am creating.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
DataObjectManager Module /
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
Editing a Member in DataObjectManager
I also run into this problem the other day. The reason is a js (ConfirmedPasswordField.js) that does not work since prototype and behaviour is blocked. I noticed like you that the password fields was visible and that I could not change a members password. To fix this I rewrote the script to have the same functionality as the original but using jQuery (see below).
Blocking the original script and calling my version in the DataObjectManager_Popup class constructor fixed this.
Requirements::block(SAPPHIRE_DIR . "/javascript/ConfirmedPasswordField.js");
Requirements::javascript('dataobject_manager/javascript/MyConfirmedPasswordField.js');
I'm no js guru so I imagine this script could be optimized, but it works!
Save the following code to a file "MyConfirmedPasswordField.js"
(function($) {
$(document).ready(function(){
$(".showOnClickContainer").hide();
$("#Password input.hidden").val(false);
$(".confirmedpassword .showOnClick a").click(function(){
$(".showOnClickContainer").toggle();
var _v = $(".showOnClickContainer").css("display") == "block" ? true : false;
$("#Password input.hidden").val(_v);
});
});
})(jQuery);
Maybe something for You to checkin, UncleCheese?
Perfect. Thank you. I was going to write something like that to get around this issue.
Thanks, I implemented that change and it does indeed work.
Uncle Cheese,
just a reminder, using the dataobjectmanager code from svn October 9th and the fix that I had put in that was working for the password fields is now not working again. I assume that you have not yet implemented your own fix for this?
I will put the fix from this thread back in and check it again after the next svn update I do.
The fix works....in a way.
I put this code in, but when i click on the link it goes to the home page. For some reason the link isn't being written correctly. instead of the full URL like http://www.mysite.com/members/profile/edit/#
the url is just being written as http://www.mysite.com/#
have no clue, so if anyone has an idea, that would be great!