Exporteren (0) Afdrukken
Alles uitvouwen
Deze inhoud is niet beschikbaar in uw taal, maar wel in het Engels.

Validate data

Updated: April 2, 2014

In a JavaScript backend mobile service, server scripts are used to enforce server-side validation rules. For example, the following insert script only allows the operation to succeed when the item being inserted has a numeric price property greater than zero. Otherwise, the script writes an error to the response by calling request.respond.

function insert(item, user, request) {
    if (typeof item.price === 'number' && item.price > 0) {
    } else {
        request.respond(statusCodes.BAD_REQUEST, 'Price must be a positive number');

For more information, see the Mobile Services script reference

© 2015 Microsoft