Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

array.push is not working titanium appecelrator

$
0
0

I am not able to submit/post my data when I am trying to add a specific entry using the push method.

I have the following code

var bounded_lblTitle=[];
$.scrView.customName = "New Entry";
var postButton;
 
if (args.fromLog == "Yes") { 
    Alloy.Globals.logViews.push($.scrView);
    Alloy.Globals.logScrollableView.views = Alloy.Globals.logViews;
    Alloy.Globals.logScrollableView.scrollToView($.scrView);
} else {
    Alloy.Globals.locationViews.push($.scrView);
    Alloy.Globals.locationScrollableView.views =    Alloy.Globals.locationViews; 
 
    Alloy.Globals.locationScrollableView.scrollToView($.scrView);
}
 
//Click event of New Entry button
function onbtnClick() {
 
    if (OS_ANDROID) {
            Alloy.Globals.buttonClickEffect(postButton);
    }
 
    var mFields = [];
 
    //Create data which will be used to create new entry
    if (TF) {
            var tf_dict = {
                    "id" : TF._id,
                    "value" : TF.value
            };
            mFields.push(tf_dict);
    }
 
    if (TA) {
            var ta_dict = {
                    "id" : TA._id,
                    "value" : TA.value
            };
            mFields.push(ta_dict);
    }
    var boolean_dict=[i];
    for (var k = 0; k < yesnobasicswitch.length; k++) {
            if (yesnobasicswitch[i]) {
 
 
                    if (yesnobasicswitch[i].value) {
                            boolean_dict[i]= {
                                    "id" : yesnobasicswitch[i]._id,
                                    "value" : yesnobasicswitch[i].value,
                                    "ca" : {
                                            "problem" : issuetextarea[i].value,
                                            "solution" : correctivetextarea[i].value
                                    }
                            };
 
                    } else {
                            boolean_dict[i] = {
                                    "id" : yesnobasicswitch[i]._id,
                                    "value" : yesnobasicswitch[i].value
                            };
 
                    }
 
                    mFields.push(boolean_dict[i]);
            }
    }
I am not sure If the code is enough to make people understand what I am trying to do. The code has been written by someone else and it is just a part of it.

Please help.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>