Functions
The Bookmark and Refresh API contains the following functions, which are part of the kony.application Namespace.
This API adds a specified key and value to the parameter list of the URL of the form.
Syntax
kony.application.addBMState(formID, key, value);
Input Parameters
Parameter | Description |
---|---|
formID [String] - Mandatory. | Identifier of the form to be bookmarked. |
key [String] - Mandatory | Key string representing the LHS of the parameter. |
value [String] - Mandatory | Value string representing the RHS of the key-value combination. The value can not be a nested structure. |
Example
addbookmark: function() { kony.application.addBMState("Form1", "About", "page2"); alert("A specified key and value are added to the parameter list of the URL"); },
Return Values
None.
Platform Availability
- Desktop Web
This API retrieves the list of parameters attached to a URL using the above add, set APIs.
Syntax
kony.application.getBMState(formID);
Input Parameters
Parameter | Description |
---|---|
formID [String] - Mandatory. | Identifier of the form for which the parameters of the URL have to be fetched. |
Example
getbookmark: function() { var a = kony.application.getBMState("Form1"); alert(" The list of parameters attached to the URL are " + JSON.stringify(a)); },
Return Values
A JSON structure representing key-values of various parameters attached to the URL string of the given form.
Platform Availability
- Desktop Web
This API removes a specified key from the parameter list of the URL of the form.
Syntax
kony.application.removeBMState(formID, key);
Input Parameters
Parameter | Description |
---|---|
formID [String] - Mandatory. | Identifier of the form for which the parameters of the URL have to be removed. |
key [String] - Mandatory | Key string representing the key to be removed. |
Example
To remove a bookmark for a URL, enter the following:
removebookmark: function() { kony.application.removeBMState("Form1", "About"); alert("The About key is removed from the parameter list"); },
Return Values
None
Platform Availability
- Desktop Web
This API resets the state associated with the URL of a form. It removes all the parameters attached to the form URL
Syntax
kony.application.resetBMState(formID);
Input Parameters
Parameter | Description |
---|---|
formID [String] - Mandatory. | Identifier of the form for which the parameters of the URL have to be removed. |
Example
resetBookmarkState: function() { kony.application.resetBMState("Form1"); alert("The state is removed from the URL"); }
Return Values
None
Platform Availability
- Desktop Web
This API sets the bookmark state to the URL. This API accepts the formID and a json structure of key value pairs which will be added to the URL of the page.
Syntax
kony.application.setBMState(formID, State);
Input Parameters
Parameter | Description |
---|---|
formID [String] - Mandatory | Identifier of the form to be bookmarked. |
state [JSON Object] - Mandatory | A JSON object comprising key value pairs. The key value pairs are user defined. You cannot specify this as a nested structure. i.e the value part can not be another JSON object. |
Example
setState: function() { var state = { Bookmark: "about", text: "About" }; kony.application.setBMState("Form1", state); alert("A new state is set to the URL "); },
Return Values
None
Platform Availability
- Desktop Web