phpjavascripthtmlxmlxsi

Passing variables from a form to a function in sencha touch


I'm working with a sencha touch on a login page, I currently have this function which passes these parameters to a webservice:

function Authenticate(username, password, theCallBack)
{
method = "Authenticate";

parameters = "<username xsi:type='xsd:string'>username</username><password xsi:type='xsd:string'>password</password><date xsi:type='xsd:date'>2009-06-05 12:15:00</date>";

// $.mobile.showPageLoadingMsg();
edarah_getDataFromWebService(method, parameters, theCallBack);
}

my problem is that in this line:

<username xsi:type='xsd:string'>username</username><password xsi:type='xsd:string'>password</password><date xsi:type='xsd:date'>2009-06-05 12:15:00</date>

the input parameters(username,password) are passed as pure strings to the webservice, I want them to be passed as variables so that when the user inputs a string, these variables contain the content of what the user typed(the values of these parameters are taken from a webform and entered into this function as parameters).

when I enter a username and password that match an entry in my database, like this:

<username xsi:type='xsd:string'>user123</username><password xsi:type='xsd:string'>1234</password><date xsi:type='xsd:date'>2009-06-05 12:15:00</date>

it works and I get the desired response, but i'm unable to input them as strings. anybody has an idea on how to make this work?


Solution

  • It's much simpler than I thought, I wasn't able to do this because of my lack of experience apparently, here's the solution:

    parameters = "<username xsi:type='xsd:string'>" + username + "</username><password xsi:type='xsd:string'>" + password + "</password><date xsi:type='xsd:date'>" + datetime + "</date>"