redirect from browse form to edit form dep on userid or grp

Questions related to customising nuBuilder Forte with Javascript or PHP.

redirect from browse form to edit form dep on userid or grp

Postby diveguy » Mon Dec 31, 2018 5:15 pm

I have a few edit forms, and I have copies of all of them that are modified for mobile viewing. The browse forms are good enough to use in either case.
I would like to be able to redirect the user to the appropriate edit form based on their userid or group. Ie: browseForm.redirectTo = user.group == "mobile users" ? mobileEditForm : desktopEditForm
But I can't find a way of doing this. Is it possible?
diveguy
 
Posts: 5
Joined: Wed May 13, 2015 3:11 am

Re: redirect from browse form to edit form dep on userid or

Postby kev1n » Mon Dec 31, 2018 5:54 pm

Hi,

You can do that by implementing your own nuSelectBrowse() function and then open the corresponding form from there.

https://wiki.nubuilder.net/nubuilderfor ... lectBrowse


Something like this:

Code: Select all
function nuSelectBrowse(e) {

    var r = $('#' + e.target.id).attr('data-nu-primary-key');  // row id

    var alc = nuAccessLevelCode();
    if (alc == "mobile users") {
        nuForm(mobileEditForm, r);  // replace with the form id
    } else {
        nuForm(desktopEditForm, r);  // replace with the form id  or use nuGetProperty('form_id');
    }
}
kev1n
 
Posts: 364
Joined: Mon Oct 15, 2018 2:13 am

Re: redirect from browse form to edit form dep on userid or

Postby diveguy » Tue Jan 01, 2019 4:51 pm

Thank You!
diveguy
 
Posts: 5
Joined: Wed May 13, 2015 3:11 am

Re: redirect from browse form to edit form dep on userid or

Postby admin » Wed Jan 02, 2019 5:59 am

.
admin
Site Admin
 
Posts: 3162
Joined: Mon Jun 15, 2009 9:53 am


Return to Custom Code



cron