01.06.2013 Views

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

afterCreate event<br />

Example:<br />

/* subscribe to event */<br />

myjsdo.subscribe('afterCreate', onAfterCreate);<br />

/* some code that would add a record and save it */<br />

var jsrecord = myjsdo.add();<br />

. . .<br />

myjsdo.saveChanges();<br />

function onAfterCreate (jsdo , record , success , request ) {<br />

if (success) {<br />

/* for example, get the values from the record for redisplay */<br />

var myField = record.data.myField;<br />

. . .<br />

}<br />

else {<br />

if (request.response && request.response._errors &&<br />

request.response._errors.length > 0){<br />

var lenErrors = request.response._errors.length;<br />

for (var idxError=0; idxError < lenErrors; idxError++) {<br />

var errorEntry = request.response._errors[idxError];<br />

var errorMsg = errorEntry._errorMsg;<br />

var errorNum = errorEntry._errorNum;<br />

/* handle error */<br />

}<br />

}<br />

}<br />

};<br />

See also: add( ) method, record property, subscribe( ) method, unsubscribe( )<br />

method<br />

184 <strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!