Search DominoPower's 11,437 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Using cookies in Lotus Domino applications is in your future (continued)

http://xxx.xxx.xxx.xxx/databasename.nsf/demo?openform

You should now be able to create a cookie and change its value by changing the value of the dropdown.

If you're getting errors, remember that Javascript is case sensitive. You can also download the demonstration database for this article from http://www.touchdown.com.au/dpcookies.zip.

We don't yet know if our example is working properly because we can't see what is inside the cookie.

We will now add the functionality required to view the value of the cookie.

Reading and viewing the cookie value
The first step is to create the HTTP_COOKIE field.

To read cookie values on a Lotus Domino form, you need a field named HTTP_COOKIE. The presence of this field on the Domino form makes the cookies available to formulas in other fields on the form.

Create the HTTP_COOKIE field and put it at the top of the form. Set the field type to "Editable". Add the following formula to the field:

HTTP_COOKIE

Domino will automatically fill it with the current cookie data.

The end user doesn't need to see this field, so we'll hide it. Select the field and right click on it. Then select "Text Properties" from the menu. On the blinds tab, select "Hide Paragraph from Web Browsers".

If you don't hide the HTTP_COOKIE field, then you get to see the raw contents of the cookies, which can be quite interesting and useful for troubleshooting.

Step two is to display the value of our cookie.

Create a new field named DisplayCookieValue. Type <BR> <BR> <BR> after the DisplayCookieValue field. Set the type of the field to "Text" and "Computed for display".

In this field, place the following formula:

@ReplaceSubstring( @Word(@RightBack(HTTP_COOKIE;"mycookie=");";";1) ; "%20" ; " " )

It's important to understand that the HTTP_COOKIE field contains one big chunk of text, containing all the cookies and all their values. The above formula parses out the specific cookie required and then parses out the value of that cookie.

Cookies also contain the escape character %20 as a replacement for spaces, so we need to substitute these values as we extract the values from the cookie.

For readability and usability, we'll put some explanatory text onto the form immediately before the DisplayCookieValue field:

The current value of mycookie is: <BR>

Select the entire contents of the page and turn on "Pass-thru HTML". Save the form.

All done: testing the solution
Fortune cookie says: "You are nearly there."

Okay, our demonstration application is finished, and it should all work now. Refresh the page in your Web browser.

You should now be able to change the value of the dropdown and see the value of the cookie change after the page has refreshed.

Uses for cookies
Fortune cookie says: "Life for you is a dashing and bold adventure."


« Previous  ·  1  ·  2  ·  3  ·  4  ·  5  ·  6  ·  Next »
Other articles you might like
Home > Internet Technologies > JavaScript (13 articles)
   Sorting your Domino views with JavaScript
   Give your Domino views life with DHTML
   Using dynamically generated HTML to thwart spam email address harvesting
Home > Internet Technologies > Cookies (2 articles)
   Where cookie comes from
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
Adding Quick Highlighter support to IBM Lotus Notes Domino Wiki, Weblog, or Webpage
Remember Young Admins...there are 2 files
WebSphere Portal 6.1.0.2 and Lotus Domino 8.5
The CKEditor - with Domino
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Struggling with exporting Notes data to spreadsheets? No More!
Try IntelliPRINT, The world's leading Reporting, Dashboards, and Analysis solution for Notes & Domino

  • Don't spend unproductive time maintaining different versions of the same spreadsheet
  • Preserve data integrity and security in multi-user environments
  • Create reports in minutes INSIDE Notes
  • Get freedom from iterative report requests, deliver self-serve capabilities

Experience Reporting, Dashboards, and Analysis INSIDE Notes.

Try IntelliPRINT NOW!

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login