Page 1 of 1
Anything happened to the libURL in 4.0?
Posted: Thu Nov 26, 2009 10:26 am
by hliljegren
Hi all!
I'm having severe problems with libUrlMultipartFormData! Has this changed in version 4 in any way??? If I execute the following code in the message box
Code: Select all
libUrlMultipartFormData(theForm, "param1", "MyValue")
I get nothing in return (as it should be) but if I execute the following:
Code: Select all
libUrlMultipartFormData(theForm, "param1", "MyValue")
Put "Hello!"
I get the following message:
Message execution error:
Error description: Handler: can't find handler
As soon as I do anything *AFTER* the libUrlMultipartFormData my programs halts with the above error message.
I've tried to reinstall my revolution studio package but still have the same result. ANY IDEAS?????
Re: Anything happened to the libURL in 4.0?
Posted: Thu Nov 26, 2009 12:03 pm
by Janschenkel
libUrlMultipartFormData is a function, not a command - so if you try to use it as a command, the rev engine can't find it and throws the 'handler not found' error. So your script should read something like:
Code: Select all
get libUrlMultipartFormData(theForm, "param1", "MyValue")
HTH,
Jan Schenkel.
Re: Anything happened to the libURL in 4.0?
Posted: Thu Nov 26, 2009 12:04 pm
by SparkOut
This must be due to a little syntax tightening in the engine I think. I don't know if and when anything has changed, but libURLMultiPartFormData definitely still works - but it is (and has always been) a
function not a command, so calling it as a command/handler is not the right way (although the example in the docs is not specific about this, to the point of being misleading!)
If you try:
Code: Select all
if libUrlMultipartFormData(theForm, "param1", "MyValue") is not empty then
answer it && "error"
else
Put "Hello!"
end if
you should hopefully find that it works.
HTH
SparkOut
[edit]Nice one Jan, beat me to it. And the "get" version is cleaner too.
Re: Anything happened to the libURL in 4.0?
Posted: Thu Nov 26, 2009 1:27 pm
by hliljegren
Well maybe I reduced my code a little bit too much. If I use the
I always get the answer dialog but with no content
Re: Anything happened to the libURL in 4.0?
Posted: Thu Nov 26, 2009 6:16 pm
by Janschenkel
Yonly need to check the return value to see if something went wrong:
Code: Select all
get libUrlMultipartFormData(theForm, "param1", "MyValue")
if it is not empty then
answer error it
else
## ... normal code
end if
Jan Schenkel.
Re: Anything happened to the libURL in 4.0?
Posted: Thu Nov 26, 2009 10:24 pm
by hliljegren
Here's my current finding:
Code: Select all
if libUrlMultipartFormData(theForm, "param1", "MyValue") is not empty then
answer it error
end if
always gives me the answer dialog with no contents!
But
Code: Select all
get libUrlMultipartFormData(theForm, "param1", "MyValue")
if it is not empty then
answer it error
end if
Works OK! The previous code worked fine for me in version 3.5 but doesn't work in 4.0. Even though this looks like a bug to me I've been into programming to long to rule out that this isn't caused by my own fault...
Actually the problem started yesterday and I installed 4.0 when it arrived, but I've been working on other parts of my application (which uses XMLRPC-calls instead) and not used the libUrl... function again until now.
But thanks Jan for giving me something that works at least!!