Posting forms to websites.

hi,

I'm making a booking gadget and need to post a form to an external website is this possible



Answer this question

Posting forms to websites.

  • Mathew1972

    *bump*

    Could someone from MicroSoft please answer on this one Is this disabled by design or is it a bug

    I've also tried to use:

    <script type="text/vbscript">
    Sub SubmitToForm()
    Set IE = CreateObject("InternetExplorer.Application")
    Dim Header
    Header = "Content-Type: application/x-www-form-urlencoded" & vbCRLF
    IE.Navigate "http://localhost/p.php", Nothing, Nothing, StringToBinary("aa=bb"), Header
    Do
    Loop While IE.Busy
    IE.Quit()
    End Sub
    Function StringToBinary(str)
    Dim tmpArr()
    Dim i
    ReDim tmpArr(Len(str))
    for i = 1 to Len(str)
    tmpArr(i-1) = CByte(AscB(Mid(str,i,1)))
    Next
    StringToBinary = tmpArr
    End Function
    </script>

    .. it will perform a POST, but the data is garbage (tried to do this is JavaScript first, put I couldn't get it to trigger a POST, it did a GET)

  • bzoli

    Are you for real. Does this work in sidebar gadgets Is it reliable and doesnt violate any security Is this the way to go
    Would be awesome if this is it!

    Jonathan and Bruce, what do you think

    Regards,
    Thor.



  • Bravo2007

    Try putting the full URL of your action parameter into the gadget. I'm not sure, but I think it should launch the external URL with the form parameters.

    Brian


  • Kart_lin

    It's a bug and has been around for quite a while. This thread was raised in Sep '06.

  • Dan-Teklynx

    Yeah, I was trying to build a diredtions gadget. Tried all of the ways I could find. Let this be the way!
  • Sean McLellan

    Here's an example you can use to do a POST from your sidebare gadget

    <HTML>
    <HEAD>
    <TITLE>Automating Form Post with IE</TITLE>
    <script language=JScript></script>
    <script language="VBScript">
    function doIEPost(formdata)
    Dim IE: Set IE = CreateObject("InternetExplorer.Application")
    IE.Navigate "about:blank" '<-- You have to do this first!!!!
    IE.Document.body.innerHTML="<Form name=frm1 id=frm1 action=http://localhost/getform.asp METHOD=POST><input type=text name=data1 value=" & escape(formdata) &"><input type=submit></form>"
    IE.Document.frm1.submit()
    Do While IE.Busy
    Loop
    result.innerHTML= unescape(IE.Document.body.innerHTML)
    IE.Quit
    set IE = Nothing
    end function
    </script>
    </HEAD>
    <BODY>
    <input type=text id=frmData>Enter Data to Post<BR>
    <input type=button onclick="doIEPost(frmData.value)" value="DO POST"><BR>
    <div id=result align="center"></div>
    </BODY >
    </HTML>

    from: http://www.eggheadcafe.com/articles/20011215.asp


  • Mervyn-w

    Yepp, it's for real .. but I still consider it a hack. A standard POST should work. Anyway, my login gadget works, using https and post, so I'm happy for now.
  • RPKJBP

    You'll be lucky!

    Hey, it's only an untested thought, but shouldn't you be able to write a cookie with the JS, to be read back in on the website - by JS/PHP/ASP

    It's how I've managed when passing form data from a JS popup back to the parent page, when that's been coded in PHP.

    Would this work, or is the cookie created locked to the sandbox IE session Can you actually write cookies at all with the sidebar platform

    Paul

  • Mutakin

    The workaround is to change your POST to a GET and add the strings to the end of the URL. This works with most sites around, but probably not all of them.

    Example:

    www.website.com/search.php search=string&category=rubber+ducks

    If you desperately need to post, I suggest you set up a page on a remote server to redirect with the post strings ie user inputs string to your gadget, gadget opens www.yourserver.com/ var1=string&var2=whatever and finally yourserver.com posts to the actual site you needed.

    Andy



  • AFTIadmin

    Thank you for your answer.

    Useing GET isn't an option since this is for a login, but maybe we need to do as you suggests, using a form "proxy". Google is doing this.

    It would be nice if somebody from Microsoft could answer if not being able to do a POST is by design or if this is a bug that will be fixed :)

    Also, if one of you gurus could tell me how to do a post using the InternetExplorer.Application object I would be very happy.

    ../Per


  • Steven Berger

    I am having the same issue and a query parameter approach will not work as the POST data is sensitive (being sent over HTTPS).

    If anyone has any ideas or even an explanation as to why this doesn't behave in a gadget the way it would in an IE environment that would be much appreciated. I am sure someone on the MSFT would have some input or knowledge as to it's behaviour.

    Thanks.

    Ryan



  • Orenbutn

    *bump* Smile

    Does anyone know if the bug preventing doing a POST from a sidebar gadget is fixed


  • Allengp

    Hello,

    I've tried something similar, with a FORM tag, and the action to an external site - with POST variables.

    The page opens correctly (as expected) - but the POST variables aren't being sent.

    Any tips/tricks for how to do so !


  • Winks

    any idea when this bug will be fixed
  • Posting forms to websites.