RE: [flexcoders] Re: Sending POST requests to php script??Help
You can, but you have to use Actionscript, not declarative mxml. Build the request object in an AS function, something like this: var oRequest:Object = {first:modelName.name.first, last:modelName.name.last, email:modelName.name.email} srv2.send(oRequest); and remove the entire mx:request/ tag. This approach is generally easier to work with because you can debug the values you are sending to the server. Tracy _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of fprihoda Sent: Monday, March 02, 2009 7:27 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Sending POST requests to php script??Help I don't want to bind the object. The {...} was suggested in a previous post. I don't understand why I can't reference the object's value in the HTTPService request. Frank --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com, Tracy Spratt tspr...@... wrote: But you are using Object, and Object is not bindable and you are trying to bind: first{modelName.name.first}/first The braces mean binding. Tracy _ From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com] On Behalf Of fprihoda Sent: Sunday, March 01, 2009 7:09 PM To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com Subject: [flexcoders] Re: Sending POST requests to php script??Help I CAN access the flex object at run-time. And it need not be bindable. For example: Alert.show(modelName.name.first,title=modelName.name.first Value); Correctly displays the modelName.name.first value. However, when I access the same object in the HTTPService request, I can not access the objects value. I don't know what the problem is. This problem is driving me nuts. Frank
RE: [flexcoders] Re: Sending POST requests to php script??Help
Well, I believe the syntax is correct, at least! The warnings are telling you something, in a way, which is that unless your objects properties are bindable flex won't be able to detect changes in them at runtime. Hence it won't work if as you might expect you want to specify the request in mxml like that. It's just the way flex works, I found it a little hard to get used to at first. You might have better results if you call an actionscript function to set the request object instead. -Original Message- From: flexcoders@yahoogroups.com on behalf of fprihoda Sent: Sun 01/03/2009 12:51 To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Sending POST requests to php script??Help This doe not work, as I am not trying to make the object bindable. I am simply trying to reference the object values and pass them as part of the HTTPService request. --- In flexcoders@yahoogroups.com, Jim Hayes j...@... wrote: I'm making a wild guess here, but does this work? mx:request xmlns= first{modelName.name.first}/first last{modelName.name.last}/last email{modelName.email}/email /mx:request Apologies if not, I've not made any attempt to see if it does so it could be utter rubbish. -Original Message- From: flexcoders@yahoogroups.com on behalf of fprihoda Sent: Sat 28/02/2009 19:09 To: flexcoders@yahoogroups.com Subject: [flexcoders] Sending POST requests to php script??Help The following code is not working as I would expect it to. mx:HTTPService id=srv2 url=http://localhost/flex_web/addform.php; resultFormat=object showBusyCursor=true result=resultHandler(event) method=POST mx:request xmlns= firstmodelName.name.first/first lastmodelName.name.last/last emailmodelName.email/email /mx:request /mx:HTTPService modelName is an object. I would like to send the POST variables to the php script using dot notation as shown above. The problem I am having is that it sends the entire string modelName.xxx.xxx instead of the actual object field. I think this is a dereferencing issue, but I do not know how to fix it. Can someone help? __ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. __ __ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. __winmail.dat
RE: [flexcoders] Re: Sending POST requests to php script??Help
Yes, building the request object declaratively and binding in the values is very hard to debug. Build the request object in AS, so you can inspect the values you are sending. You also will not need to depend on bindable properties. Tracy -Original Message- From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Jim Hayes Sent: Sunday, March 01, 2009 1:51 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: Sending POST requests to php script??Help Well, I believe the syntax is correct, at least! The warnings are telling you something, in a way, which is that unless your objects properties are bindable flex won't be able to detect changes in them at runtime. Hence it won't work if as you might expect you want to specify the request in mxml like that. It's just the way flex works, I found it a little hard to get used to at first. You might have better results if you call an actionscript function to set the request object instead. -Original Message- From: flexcoders@yahoogroups.com on behalf of fprihoda Sent: Sun 01/03/2009 12:51 To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Sending POST requests to php script??Help This doe not work, as I am not trying to make the object bindable. I am simply trying to reference the object values and pass them as part of the HTTPService request. --- In flexcoders@yahoogroups.com, Jim Hayes j...@... wrote: I'm making a wild guess here, but does this work? mx:request xmlns= first{modelName.name.first}/first last{modelName.name.last}/last email{modelName.email}/email /mx:request Apologies if not, I've not made any attempt to see if it does so it could be utter rubbish. -Original Message- From: flexcoders@yahoogroups.com on behalf of fprihoda Sent: Sat 28/02/2009 19:09 To: flexcoders@yahoogroups.com Subject: [flexcoders] Sending POST requests to php script??Help The following code is not working as I would expect it to. mx:HTTPService id=srv2 url=http://localhost/flex_web/addform.php; resultFormat=object showBusyCursor=true result=resultHandler(event) method=POST mx:request xmlns= firstmodelName.name.first/first lastmodelName.name.last/last emailmodelName.email/email /mx:request /mx:HTTPService modelName is an object. I would like to send the POST variables to the php script using dot notation as shown above. The problem I am having is that it sends the entire string modelName.xxx.xxx instead of the actual object field. I think this is a dereferencing issue, but I do not know how to fix it. Can someone help? __ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. __ __ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. __
RE: [flexcoders] Re: Sending POST requests to php script??Help
But you are using Object, and Object is not bindable and you are trying to bind: first{modelName.name.first}/first The braces mean binding. Tracy _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of fprihoda Sent: Sunday, March 01, 2009 7:09 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Sending POST requests to php script??Help I CAN access the flex object at run-time. And it need not be bindable. For example: Alert.show(modelName.name.first,title=modelName.name.first Value); Correctly displays the modelName.name.first value. However, when I access the same object in the HTTPService request, I can not access the objects value. I don't know what the problem is. This problem is driving me nuts. Frank