Search DominoPower's 11,441 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)

At the very bottom of the form, put the following line, which will prevent display of the submit button automatically generated by Domino. Ensure this remains as the final line at the end of the form throughout these instructions.

<noscript>

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

Save the form.

This Javascript function is all you need to create cookies at the client end. It isn't much use on its own however. We need to call the function and tell it what name to give the cookie and what value to put in the cookie. Read on.

The dropdown field
To change the cookie value, we'll create a dropdown field, and in the HTML attributes for that field we'll put an "onchange" event. The onchange event is triggered when the value of the dropdown field changes to a new value.

In this case, the onchange event will call the SetCookie Javascript function, with the value of the dropdown field being used as the new cookie value.

Create a new field and name it "NewCookieValue". Remember that Javascript is case sensitive, so you should ensure that the caps match.

Above the field, type the following HTML onto the form:

Change the value of the cookie "mycookie" to:<BR>

Set the field type to "Dialog list" and "Editable".

Enter the following values into the dropdown choices:

Accept the next proposition you hear.
Perfection makes perfect.
Romance moves you in a new direction.
Smile when you are ready.
You are going to have some new clothes.
You have a yearning for perfection.
You love peace.
You will be awarded some great honor.
Your income will increase.
Your planning will bring rich rewards.

Enter the following code into the "HTML attributes" for the "NewCookieValue" field:

"onChange=\'SetCookie(\"mycookie\", document.forms[0].NewCookieValue.options[document.forms[0].NewCookieValue.selectedIndex].text)\'"

This code is an "inline Javascript event". It's associated with the dropdown field that we have created, and it triggers when the value in the field is changed by the end user. When the event is triggered, it calls the "SetCookie" Javascript function that we created earlier. It passes some parameters to the "SetCookie" Javascript function.

The first parameter is the cookie name, which we have hard coded to "mycookie", for no particular reason. You can name your cookies whatever you want.

The second parameter is the cookie value. The rather complex looking line of Javascript is actually simply a reference to the currently selected item in the "NewCookieValue" dropdown field.

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

Save the form.

So far, so good.

Our sample form should now work.

Load the form in a Web browser by typing:


« 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
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> 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 --

Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.

Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.

Learn how to easily clean up your address book.

-- Advertisement --

Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.

Register by April 10 to save $200.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login