|
Whitebeam Object Definition
|
Method Description
Member.constructor()
Create a new JavaScript Member object.
Syntax
Interest = Member.constructor(initData)
Parameters
The 'Member.constructor' method takes 1 parameter:
Name | Type/Value | Range/Length | Description | initData | MetaData | | Optional. JS object containing initialisation fields for the the Member object. |
Results
The 'Member.constructor' method returns Interest:
Type/Value | Range/Length | Description |
Interest |
  |
Returns the newly created Member object.
The most common way of obtaining the initialisation data is through a form submition - where the names of the
fields on the form match the property names of the Member object. This can be seen in the following example.
|
Remarks This is the JavaScript constructor for the 'Member' class. The constructor takes a single optional parameter - initData.
If this parameter is absent the constructor creates an empty Member. If initData is present then the following steps are taken: - The uName and ID property of initData are checked - if either are present the code attempts to load the corresponding
Member from the persistent store.
- initData is then searched for properties with names corresponding to Member properties. Those that are found are copied
to the initialised Member object - overlaying those values over the top of any values currently stored in the object.
The second part of this initialisation takes place whether or not any values were recovered from the persistent membership store! This method is invoked indirectly through a statement such as: var aMember = new Member(initData);
|
The new member is not added to the persisitent membership store - and no changes from the initialisation data are
committed to the persistent data store until the 'save' method is invoked on the member object.
|
Example
// Create a new member using the values stored
// provided by the user completing a form.
var formData = rb.page.formdata();
var aMember = new Member(formData);
// So far all we've done is create a JavaScript object. Need
// to store this permanently.
aMember.create();
|
|
(loadtime : 12ms) |