Search code examples
jsonrestlotus-domino

Domino Access Service - Form property not submitted


I have copied the routine how to perform a post action towards Domino Access Service inspired by the example described here:

http://www.browniesblog.com/A55CBC/blog.nsf/dx/09042013111234MBRF6E.htm?opendocument

The problem is that all properties get submitted except the Form property. Why is this?

$(document).ready(function() {
    $(".btnRegister").click(function(e) {   
        var firstName = $(".firstName").val();
        var lastName = $(".lastName").val();
        var email = $(".email").val();
        var password = $(".wannebepassword").val(); 
        var newName = $(".firstName").val() + " " + $(".lastName").val();
        if (newName !== " ") {      
            var newPersonObj = {Form: "Person", FirstName: firstName, LastName: lastName, FullName: newName, InternetAddress: email, HTTPPassword: password, Form: "Person"};
            $.ajax({
                url: 'http://server/names.nsf/api/data/documents',
                type: 'POST',
                data: JSON.stringify(newPersonObj),
                    dataType: 'xml',
                    accepts: {
                        xml: 'text/xml',
                        text: 'text/plain'
                    },
                contentType: "application/json"
            }).done(function(data, textStatus, jqXHR) {
                    var newPersonLocation = jqXHR.getResponseHeader("Location");
                     $("#formResponse").html('Registration successfull.  Location = <a href="' + newPersonLocation + '">' + newPersonLocation + '</a><br>' + $("#myConsole").html());
            }).fail(function(jqXHR, textStatus, errorThrown) {
            alert("Registration has failed:" + errorThrown );
                console.log('Registration has failed.');
            });
        }
        else {
            alert("Please enter a name");
        }
        return false;
    });
});

Solution

  • Try to add a field in your form with the name (I suggest also HTML Tag: ID) FORM, editable with default value:

    Form
    

    NB editable is not mandatory, Computed is also possible.