?
Solved

cookies

Posted on 2003-02-27
8
Medium Priority
?
292 Views
Last Modified: 2013-12-18
I have a multi value dialog list called 'Roles' this does a look up of all the user roles available in the ACL.  A user will then select which roles they want to and submit the form.  On submission this should call the javascript to set the cookie value.

The cookie value will need to store the roles the user has selected in 'Roles' field.  There will then be a field called 'EffectiveRoles' stored on all the forms in the database which will need to get the values of the 'Roles' field stored in the cookie.  If the cookies is empty ie the user has not submitted the form then the field will be set to @UserRoles.

I need to know how to set the multi values of the 'Roles' field in the cookie and then retrieve them in the 'EffectiveRoles' field.
0
Comment
Question by:fayeb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 5

Expert Comment

by:AndrewJayPollack
ID: 8033093
why do that at all?  Why not just use @UserRoles on all the forms?  Storing them locally allows them to be hacked by a smart user.
0
 

Author Comment

by:fayeb
ID: 8033167
The customer wants the user to be able to select what roles they would like to use.  It's whats been asked for!
0
 

Author Comment

by:fayeb
ID: 8033476
All I need to know is how do i read the values from a multivalue field and set them in the cookie e.g. Roles=[role1],[role2];
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 8034434
In cookie, seperate roles by comma

~Hemanth
0
 

Author Comment

by:fayeb
ID: 8034645
Whats the javascript that does this?
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 400 total points
ID: 8035864
Ok, here are the formulas.

On the form where your DialogList named Roles is put this into your DialogList options formula:
@Trim(@Replace(@UserRoles;"$$WebClient";""))

The checkbox for AlowMultipleValues is checked.

On this form where the DialogList "Roles" is placed you need two things:
1.) This scropt in JSHeader section of the Form:
function setRoles(){
  theRoles=document.forms[0].Roles;
  selRoles=""
  for(i=0;i<theRoles.options.length;i++)
    if(theRoles.options[i].selected)
      selRoles+=','+theRoles.options[i].text;
  if(selRoles>'')
    document.cookie="Roles="+escape(selRoles.substr(1))+";path=/;"
}

2.) This script invocation in Form's onSubmit event:
setRoles()

So, now on the same Form or another Form where your MultiValue Field named "EffectiveRoles" is you need two Fields:
1.) Field named "HTTP_Cookie" best as ComputedForDisplay with this @Formula:
HTTP_Cookie

2.) Field named "EffectiveRoles" with this @formula:
FIELD HTTP_Cookie:=HTTP_Cookie;
selRoles:=@Left(@Right(HTTP_Cookie;"Roles=")+";";";");
@If(selRoles="";@Return(@Text(@Trim(@Replace(@UserRoles;"$$WebClient";""))));"");
@Explode(@ReplaceSubstring(selRoles;"%2C":"%5B":"%5D";",":"[":"]");",")

I think, best choice for Field "EffectiveRoles" is to be Computed with the upper value formula.

Give it now a try.

So long,
Zvonko

0
 

Author Comment

by:fayeb
ID: 8040645
Thanks this is exactly what I needed.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8040793
You are welcome :-)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question