[Gambas-user] webform questions.

T Lee Davidson t.lee.davidson at gmail.com
Mon Nov 7 19:10:14 CET 2022


On 11/7/22 11:51, Marco Ancillotti wrote:
> 1) I need to open a url in a new tab passing some parameters , I've made it works in plain html and
>      I've put it in a webhtml container that works but I would like to do it directly in a gambas webbutton.
> 
>      The code I use in the webhtml is:
> 
>      <form action="http://miohost/xxx/yyy.cgi" method="GET">
>      <input type="hidden" name="user" value="pippo">
>      <input type="hidden" name="pass" value="pluto">
>      <button type="submit" formtarget="_blank"/>Open in new tab</button></form>
> 
>      This open a new tab passing values, but I can't find a way to made the same in the _click code of a webbutton.

Do you mean the Click event of WebButton? See:
http://gambaswiki.org/wiki/comp/gb.web.gui/webbutton/immediate

I have not worked with gb.web.gui, so I am unsure exactly how to generate javascript on the client side. Nonetheless, if I am 
understanding the documentation correctly, you would need to give your form a name, for example:
<form name=myForm action="http://miohost/xxx/yyy.cgi" method="GET">

and then generate this javascript code in the Click event of your WebButton:
document.myForm.submit()


Now you may already know this, so for the sake of others: by using the GET method in your form, you are sending the "user" and 
"pass" values in clear text in the URL.


-- 
Lee



More information about the User mailing list