submit.lzx
<library>
<class name="submit" extends="node">
<attribute name="dataset" value="null
"/>
<attribute name="status" type="string" value="ok
"/>
<attribute name="error" type="string" value="
"/>
<attribute name="_timeoutDel" value="null
"/>
<attribute name="_errorDel" value="null
"/>
<attribute name="_dataDel" value="null
"/>
<setter name="dataset" args="dset">
this._clearDels();
this.dataset = dset;
if (dset == null) {
return;
}
this._dataDel = new LzDelegate(this, "_recvdata",
this.dataset, "ondata");
this._errorDel = new LzDelegate(this, "_recverror",
this.dataset, "onerror");
this._timeoutDel = new LzDelegate(this, "_recvtimeout",
this.dataset, "ontimeout");
</setter>
<method name="setDataset" args="dset">
if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
this.setAttribute("dataset", dset);
</method>
<method name="_recvdata" args="v">
this.setAttribute('status', 'ok');
this.setAttribute('error', '');
</method>
<method name="_recverror" args="v">
if ($debug) Debug.error('form submission error: %s', this.dataset);
this.setAttribute('status', 'error');
this.setAttribute('error', this.dataset.getErrorString());
</method>
<method name="_recvtimeout" args="v">
if ($debug) Debug.error('form submission timeout');
this.setAttribute('status', 'timeout');
this.setAttribute('error', this.dataset.getErrorString());
</method>
<method name="submit">
if (! this.dataset) {
return;
}
//Debug.write('submit', parent, parent.formdata);
var query_data = new lz.Param(); // data for the query
for (var i in parent.formdata) {
var item = parent.formdata[i];
var submitname = item.submitname;
if (submitname == "") submitname = item.name;
if (submitname != "" && parent.formdata[i].submit) {
query_data.addValue(submitname,item.getValue(), true);
}
}
this.setAttribute('status', 'requesting');
this.setAttribute('error', '');
this.dataset.setQueryString( query_data );
this.dataset.doRequest();
</method>
<method name="_clearDels">
if (this._dataDel) {
this._dataDel.unregisterAll();
this._dataDel = null;
}
if (this._errorDel) {
this._errorDel.unregisterAll();
this._errorDel = null;
}
if (this._timeoutDel) {
this._timeoutDel.unregisterAll();
this._timeoutDel = null;
}
</method>
<doc>
<tag name="shortdesc"><text>associates a form with a dataset</text></tag>
<text>
<p>
Used with <classname>form</classname> or <classname>baseform</classname>, the <tagname>submit</tagname> tag associates the
form with its dataset. See <tagname>form</tagname> tag for example code.
</p>
<seealso>
<tags>form baseform dataset</tags>
</seealso>
</text>
</doc>
</class>
</library>
Cross References
Classes
- <class name="submit" extends="node">