Set Cookie Value

The Set Cookie Value behavior sets the value of a cookie based on a client-side event on the page.

It is typically applied to a form and is triggered by the onSubmit event of the form, although it can be associated to other form tags or the body tag dependent on the event you wish to trigger it.

The behavior can retrieve the value to be set from a specified form element on the page, or a value entered directly in the behavior.

As well, the behavior can run automatically every time its associated event occurs, or if a specified checkbox on the page is checked or unchecked at the time of that event.

To apply the Set Cookie Value behavior:

  1. Select the form tag (or the tag that contains the appropriate event to trigger setting the cookie).
  2. Click the Plus (+) button in the Behaviors panel and select WebAssist > Cookies > Set Cookie Value.

    The Set Cookie Value dialog box will open:

  3. Select the Cookie name whose value is to be set, or enter the name of a new cookie to be defined for the site.
  4. Set the number of days that the cookie value is to be retained for.
  5. Choose how you wish to set the Cookie value. You may retrieve the value from a form element available on the page or enter a static value which will always be set.
  6. Choose whether you want the cookie to be Always set when this event is triggered, or if a specified check box on the page is either checked or unchecked.
  7. Click OK to apply the behavior.
  8. In the Behaviors panel, be sure that the appropriate event is selected to trigger the behavior.