Booking validation in a big if-elseif block I have pasted a part of my event handler code block. I understand this code really looks like a mess specially the object that is created every time the message is changing. Is cleanup possible in this code? Any inputs will help.

btn.addEventListener('click', procs.debounce(bookDiningBtnHandler, 400));
var bookDiningBtnHandler = function() {
    btnContext = this, message = {};
    btnContext.touchEnabled = false;
    btnContext.children[0].bubbleParent = 'false';      
    hideKeyBoard();
    // Avoid overlap of keyboard with the prompt..
    removeDatePicker();
    // Avoid overlap of picker with the prompt..

    var isValidEmail = procs.checkValidEmail(email.value);
    var isIntPositive = procs.isPositiveInteger(guest.value);

    if (name.value != '' &amp;&amp; isValidEmail != false &amp;&amp; isIntPositive != false &amp;&amp; guest.value &gt; 0 &amp;&amp; date.text != 'Date' &amp;&amp; time.text != 'Time') {
        if (guest.value &gt; guestLimit) {
            message = {
                "ref" : 0,
                "title" : "Attention",
                "text" : "Booking for more than 6, Please book through XYZ!"
            };
            customAlert(message);
            return;
        }
        booking = {
            "action" : "diningBook",
            "emailReservations" : Alloy.Globals.data.dining.ER,
            "name" : name.value,
            "email" : email.value,
            "guest" : guest.value,
            "date" : date.text,
            "time" : time.text
        };

        if(checkLastBooked(booking, Alloy.Globals.BDD)){
            message = {
                "ref" : 0,
                "title" : "Attention",
                "text" : "Bookings were made earlier!"
            };
            customAlert(message);   
            return;         
        }               
        Alloy.Globals.BDD = booking;                    
        procs.sendEmail(booking, function(e) {
            treatTheAnswer(e);
            customAlert(message);
            //Ti.API.info('email  passed!');
        });
        function treatTheAnswer(resultSentEmail) {
            if (resultSentEmail) {
                message = {
                    "ref" : 0,
                    "title" : "Booking sent",
                    "text" : "A member of our team will contact you to confirm your BK"
                };
            } else {
                message = {
                    "ref" : 1,
                    "title" : "Error ",
                    "text" : "Something went wrong. Please try again later!"
                };
            }
        }

    } else {
        message = {
            "ref" : 0,
            "title" : "Missed info",
            "text" : "Missing information, Please fill in all fields!"
        };
        if (!isValidEmail &amp;&amp; isIntPositive) {
            message = {
                "ref" : 1,
                "title" : "Error",
                "text" : " Invalid Email Address. Please re-enter valid Address!"
            };
        }
        customAlert(message);
        //Ti.API.info(' validation  failed!');

    }
};
Conditionals

isValidEmail != false &amp;&amp; isIntPositive != false

I'd make that isValidEmail == true &amp;&amp; isIntPositive == true. You could even short these to isValidEmail &amp;&amp; isIntPositive. This makes your code more readable AND uses less characters (less that has to be read). It's a win-win.

var isIntPositive = procs.isPositiveInteger(guest.value);
... isIntPositive != false &amp;&amp; guest.value &gt; 0 ...


I don't know what isPositiveInteger does, but I have the feeling this check (guest.value &gt; 0) is redundant. If you don't allow 0 then explicitly decline that value with guest.value != 0.

Duplication

You have a lot of message = { ... }. I'd create a separate function that takes the arguments. Then I'd create separate functions for the constants to be wrapped in, so you get things like this:

function createInvalidEmailMessage(){
    return createMessageObject(1, "Error", "Invalid Email Address. Please re-enter valid Address!");
}
function createMessageObject(ref, title, text){
    return {
        "ref": ref,
        "title": title,
        "text": text
    };
}