|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
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:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 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. |
|
|
|
|
|
|
|
|
|
|