2 way picklist

I have a 2 way picklist on the form. There are some pre-populated values
on the right side when the form gets loaded. Now, if the user tries to
de-select those values and move them to left side, i need to give a
message and a yes, no option. If user selects yes, the value should move
to left and if user selects no the value should remain on the right
side. but this behaviour should not happen if user moves a value from
left to right. Can anybody suggest how can i achieve this
functionality.

Regards
Saurabh Kachru


-- 
skachru
------------------------------------------------------------------------



0
skachru
1/7/2010 7:36:02 AM
novell.id-manager.userapp 4379 articles. 0 followers. Follow

8 Replies
258 Views

Similar Articles

[PageSpeed] 34

On 01/07/2010 01:36 AM, skachru wrote:

> 
> I have a 2 way picklist on the form. There are some pre-populated values
> on the right side when the form gets loaded. Now, if the user tries to
> de-select those values and move them to left side, i need to give a
> message and a yes, no option. If user selects yes, the value should move
> to left and if user selects no the value should remain on the right
> side. but this behaviour should not happen if user moves a value from
> left to right. Can anybody suggest how can i achieve this
> functionality.
> 
> Regards
> Saurabh Kachru
> 
> 


I think something like this has come up in the past and if I remember
correctly you cannot do this, because there is no even handling in the
part of the picklist that holds the selected values.

You would basically have to use to separate fields and handle all the
events your self of moving the data from left to right.
0
John
1/7/2010 12:46:32 PM
Theoretically, you could react on the 'onchange' event, but the main problem 
is that this event is triggered after the act.

Therefor, you'd need to ...
* use some global variable to keep track of the old selection,
* onchange: compare old and new selection,
* use confirm() to alert the user,
* if necessary, restore the old selection,
* save the new selection to your global variable

Should be possible in <30 script lines, but might be a challenge for 
beginners.

Wolfgang


"skachru" <skachru@no-mx.forums.novell.com> wrote in message 
news:skachru.44eri0@no-mx.forums.novell.com...
>
> I have a 2 way picklist on the form. There are some pre-populated values
> on the right side when the form gets loaded. Now, if the user tries to
> de-select those values and move them to left side, i need to give a
> message and a yes, no option. If user selects yes, the value should move
> to left and if user selects no the value should remain on the right
> side. but this behaviour should not happen if user moves a value from
> left to right. Can anybody suggest how can i achieve this
> functionality.
>
> Regards
> Saurabh Kachru
>
>
> -- 
> skachru
> ------------------------------------------------------------------------
> skachru's Profile: http://forums.novell.com/member.php?userid=22778
> View this thread: http://forums.novell.com/showthread.php?t=397517
> 


0
Wolfgang
1/7/2010 11:02:15 PM
IDM 3.6.1 patch B, Do you have any sample code for 2 way pick list, I
did  show 2 lists:true in properites.  But i need to to show or hide the
pick list need to write code any body have sample code?  Which event i
suppose to write.....


-- 
kpnaidu
------------------------------------------------------------------------
kpnaidu's Profile: http://forums.novell.com/member.php?userid=70003
View this thread: http://forums.novell.com/showthread.php?t=397517

0
kpnaidu
2/26/2010 10:16:02 PM
Greetings,

form.hide(%fieldname%);


Sincerely,
Steven Williams
exteNd & IDM Senior Specialist
Novell Engineering


On Fri, 26 Feb 2010 22:16:02 +0000, kpnaidu wrote:

> IDM 3.6.1 patch B, Do you have any sample code for 2 way pick list, I
> did  show 2 lists:true in properites.  But i need to to show or hide the
> pick list need to write code any body have sample code?  Which event i
> suppose to write.....

0
Steven
2/27/2010 12:06:25 AM
I have declared picklist name as a picklistName and property is set to
show 2 lists:true, So In form I have to show two list and in between
"<<"  ">>" .  
form.show("picklistName");  //picklistName0
form.show("picklistName1"); //picklistName1

Is it Correct statement?


-- 
kpnaidu
------------------------------------------------------------------------
kpnaidu's Profile: http://forums.novell.com/member.php?userid=70003
View this thread: http://forums.novell.com/showthread.php?t=397517

0
kpnaidu
2/28/2010 3:36:01 PM
On 02/28/2010 09:36 AM, kpnaidu wrote:

> 
> I have declared picklist name as a picklistName and property is set to
> show 2 lists:true, So In form I have to show two list and in between
> "<<"  ">>" .  
> form.show("picklistName");  //picklistName0
> form.show("picklistName1"); //picklistName1
> 
> Is it Correct statement?
> 
> 


No, you can only hide the entire picklist not only half of the 2 column
picklist. My original response stated that.


0
John
2/28/2010 3:46:16 PM
Greetings,
   It is not possible to drag - n - drop or move via arrows between two 
different picklists (The question was asked to Support who confirmed  the 
other day, and they confirmed it with me.  Was it you who asked it via 
Support as well?)

Sincerely,
Steven Williams
exteNd & IDM Senior Specialist
Novell Engineering

On Sun, 28 Feb 2010 15:46:16 +0000, John DaSilva wrote:

> On 02/28/2010 09:36 AM, kpnaidu wrote:
> 
> 
>> I have declared picklist name as a picklistName and property is set to
>> show 2 lists:true, So In form I have to show two list and in between
>> "<<"  ">>" .
>> form.show("picklistName");  //picklistName0 form.show("picklistName1");
>> //picklistName1
>> 
>> Is it Correct statement?
>> 
>> 
>> 
> 
> No, you can only hide the entire picklist not only half of the 2 column
> picklist. My original response stated that.

0
Steven
2/28/2010 11:58:13 PM
If I understand your request, I was able to facilitate this by using two
picklists, custom field events, and an HTML field containing two buttons
that, when clicked, executed the field events and required a
verification.  Though klugey, I did this because the two-way picklist
didn't solve all my needs, I didn't want some things to show up in
either field and, truthfully, I wanted to see if it could be done. :)

In our case the left picklist is called "requestroles" and the right
picklist is called "currentroles".  An "onload" event assigned to the
"currentroles" picklist populates that field with all the roles assigned
to the user.  Another event called "getLists", assigned to the
"requestroles" picklist, populates that field with all roles available
(via DAL query), subtracting any roles that are displayed in the
"currentroles" picklist.  After the "currentroles" onload event finishes
it executes "requestroles"/"getLists" event, so the end result in the
"requestroles" picklist displays the difference of ALL roles minus the
ones listed in "currentroles".  Simple, no?  Seems like a lot of
unnecessary work that a 2-way picklist does automatically, but it makes
sense later.

I then created events called "getSelected" and "putSelected" and
assigned them to the "currentroles" picklist.

"getSelected" takes any highlighted roles from the "requestroles"
picklist and adds them to the "currentroles" picklist, then it executes
"requestroles"/"getLists" (this may seem redundant but to allow movement
of roles BACK - like if they change their mind - I needed to do this),
thereby repopulating the "requestroles" with the subset of ALL roles
minus those listed in "currentroles".

"putSelected" takes any selected roles from the "currentroles" picklist
and removes them, then executes "requestroles"/"getLists" again.  This
makes "requestroles" to refresh, because if you just added the role to
the list it just appends to the bottom; confusing to users.

Using an HTML field I then created two buttons in a table (so they
align nicely): one on top that executes "getSelected" - moving roles
from the left field to the right, and the bottom button that executes
"putSelected" - moving roles from the right to the left.

The code that executes "putSelected" (thereby deselecting the role)
includes a confirm() action, prompting the user to verify.

It would have been a heckuva lot easier if you could intercept an
action like that (kind of like you can intercept a Submit action), and
if you deselected a role if it would repopulate it in order (rather than
appending to the bottom), but since you can't I had to reinvent the
wheel by-way-of-Cleveland.

I've included the code below (derived from 'this'
(http://www.novell.com/communities/node/4026/fire-event-button-click-idm-designer-userapp)
article), but I've not posted code before so please let me know if it
doesn't work right:

(function(){return "<table><tr><td>&nbsp;</td></tr><tr><td><input
type=\"button\" value=\">>\" onClick=\"var evt = new
JUICE.WFASEvent(&quot;currentroles&quot;,&quot;getSelected&quot;, null,
null, null);  var evt_array = new Array(evt);
dojo.publish(&quot;WFAS_getSelected&quot;,
evt_array);\"></td></tr><tr><td><input type=\"button\" value=\"<<\"
onClick=\"var ctrl =
JUICE.UICtrlUtil.getControl(&quot;currentroles&quot;); var marc =
JUICE.UICtrlUtil.getValues(ctrl);
if(JUICE.UICtrlUtil.getValues(ctrl).length>0){ if(confirm(&quot;Are you
sure you want to remove this membership?&quot;)){var evt = new
JUICE.WFASEvent(&quot;currentroles&quot;,&quot;putSelected&quot;, null,
null, null);  var evt_array = new Array(evt);
dojo.publish(&quot;WFAS_putSelected&quot;, evt_array);};};
\"></td></tr><tr><td>&nbsp;</td></tr></table>";}) ();


-- 
mlichon
------------------------------------------------------------------------
mlichon's Profile: http://forums.novell.com/member.php?userid=56947
View this thread: http://forums.novell.com/showthread.php?t=397517

0
mlichon
3/3/2010 4:06:02 PM
Reply: