2

Can someone please tell me how to create a webform submission on XML form? Or if not can you please correct this code and tell me where I'm going wrong??

I've been struggling for a week This is my code :

                var i:uint=new uint();
                for(i=0;i<count;i++)
                {   
                    trace("These are the inputs"+myInputs[i].text);
                }
                trace("this is the user's token "+token);
                var headers:Array = [
                    new URLRequestHeader("Content-Type","application/x-www-form-urlencoded"),
                    new URLRequestHeader("X-CSRF-Token",_userXML.token)
                ];

                var request:URLRequest = new URLRequest;
                request.url=Constants.DOMAIN+"/api/submission";
                request.requestHeaders = headers;

                trace("this is the uuid we get from FormsListScreen"+FormsListScreen.item.uuid);
                var requestVars:URLVariables = new URLVariables();
                requestVars['webform'] = FormsListScreen.item.uuid;
                for (i=0;i<count;i++)
                {
                    requestVars['submission[data]['+i+'][values][0]']= myInputs[i].text;
                }
                trace("This is the request variable webform"+requestVars['webform']);
                request.data=requestVars;
                request.method = URLRequestMethod.POST;
                requestor = new URLLoader();
                requestor.load(request);
                requestor.addEventListener(flash.events.Event.COMPLETE, SubmissionDone);
                requestor.addEventListener(flash.events.IOErrorEvent.IO_ERROR, httpRequestError);
                requestor.addEventListener(flash.events.SecurityErrorEvent.SECURITY_ERROR, httpRequestError);
                requestor.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);

I tried with x-www-form-urlencoded in POSTMAN and it works fine with

submission[data][1][values][0] for each submission

But I'm somehow not able to do it in as3 using x-www-form-urlencoded ,infact i'm getting a stream error 2023 for the URL now

PLEASE HELP!

closed as off-topic by kiamlaluno Apr 19 '18 at 21:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on programming, PHP, SQL, etc. that do not relate directly to Drupal are off-topic here, but can be asked on Stack Overflow." – kiamlaluno
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.