Put text into fld at a website

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

User87
Livecode Opensource Backer
Livecode Opensource Backer

Put text into fld at a website

Post by User87 » Sun Feb 14, 2016 5:43 pm

Hello,
I have my mozilla firefox browser with an simple website with the following code:
<HTML>
<HEAD>
<TITLE>My website</TITLE>
</HEAD>
<BODY>
<textarea id="output-field"></textarea>
</BODY>
</HTML>

At this website there only is a textarea with the id "output-field".
Now I have my simple livecode programm with just one push button. If I push the button I want it to put the text "Hello World" into the field "output-field" at my website.

Is this possible?

Best Regards
User87

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Put text into fld at a website

Post by LCNeil » Mon Feb 15, 2016 1:27 pm

Hi User87,

Yes this is possible by executing some Javascript on the webpage. You should be able to use something like-

Code: Select all

   get revBrowserExecuteScript(1, "document.getElementById('output-field').value = 'value'")
You will need to change the "1" above to reflect your LiveCode browser instance.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Mon Feb 15, 2016 5:27 pm

Hi Neil,
thanks for your response.
Where do I get my browser ID to replace it with "1" in your example?
I use Mozilla Firefox.

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Mon Feb 15, 2016 5:39 pm

To make shure you understand me.
I do not use the revBrowser in livecode.
I use Mozilla Firefox (with the website which is already open)
And in addition to that I use my livecode programm with the push button on it.
It's both seperate in use.

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Put text into fld at a website

Post by LCNeil » Mon Feb 15, 2016 5:42 pm

Hi User87,

The browser ID is returned after you create a browser instance via revBrowserOpenCef. An example of this can be found here-

http://lessons.livecode.com/m/2592/l/27 ... n-your-app

Any created browser instance IDs can also be returned by function revBrowserInstances.

From your last response, it looks as though you are trying to enter text in an external browser (not one created in LiveCode). This is not something that is directly possible but you may be able to set your server/site up to accept POST/GET parameters which your can fire from a LiveCode app.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Mon Feb 15, 2016 6:37 pm

Yes it is a external browser.
The website in which I want to past text (in the textfield at the website) is not my website. I can not change the website due to the POST/GET parameters.
Therefore I am afraid it is not possible what I want to do? :(

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Put text into fld at a website

Post by LCNeil » Mon Feb 15, 2016 7:01 pm

Is there any reason you cannot create a browser instance in your app and fill in the text box that way?

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Mon Feb 15, 2016 7:04 pm

Yes. The website only is used with Mozilla Firefox the whole time.
Maybe if I use the livecode browser intance something will not work on the website.

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Put text into fld at a website

Post by LCNeil » Mon Feb 15, 2016 7:12 pm

The latest LiveCode browser instances use the Chromium Embedded framework which is a very modern and up-to-date embedded browser engine.

Many applications use this so I would suggest testing this your website as you may find it equally comparable to the FireFox browser.

A list of application that use CEF can be found here-

https://en.wikipedia.org/wiki/Chromium_ ... _using_CEF

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Mon Feb 15, 2016 7:33 pm

Another issue is that i normally use 20-30 tabs at the same time in firefox.
You think a livecode programm would be fast and stable enough to handle this?
And also is it possible to install browser add ons to the livecode browser? This is very important I use DownThemAll as add on in firefox.

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Mon Feb 15, 2016 9:00 pm

Now I made a livecode app with the browser instance. But the Standalone Application doesn't work with windows 10.
No browser is created.
In livecode itself it works.
I exactly did what is said in this tutorial: http://lessons.livecode.com/m/2592/l/27 ... n-your-app
You have any idea why the Standalone does not work?

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Put text into fld at a website

Post by LCNeil » Tue Feb 16, 2016 12:34 pm

Tabs are not supported neither are browser addons so that is one element you would have to create manually (e.g. multiple browser instances for tabs)

In regards to the browser instance, what version of LiveCode are you using? It could be that the required inclusions are not being automatically set.

To resolve this, check the Browser (CEF) option from your apps standalone settings as this will manually included the required script library.
Screen Shot 2016-02-16 at 11.32.49.png
Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
--

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Put text into fld at a website

Post by AndyP » Thu Feb 18, 2016 6:50 pm

To your info into an existing web page do the following.

This is a working example on my site for you to test with.

in a button add this

on mouseUp
put urlEncode(fld "Email") into tEmail
launch URL "http://2108.co.uk/code/php/temp/form.php?Email="& tEmail
end mouseUp

Then you need a php page which will include your form and the code to collect the data from LC

<?php
if(isset($_GET['Email'])) $var=$_GET['Email'];
?>

<form action="http://2108.co.uk/code/php/temp/form.php" method="POST">
<input type='text' name='var' value="<?php echo "$var";?>" />
</form>
Andy .... LC CLASSIC ROCKS!

User87
Livecode Opensource Backer
Livecode Opensource Backer

Re: Put text into fld at a website

Post by User87 » Thu Feb 18, 2016 7:21 pm

Hello,

@Neil:
Thanks it works :). Now I has to figure out how to add the tab navigation and how to open links via contect menu with right click.

@Andi:
Thank you for your help.
The problem is I can not change the web site to add the code on it. It is not my website.
Imagine I would put the text in the search field at www.google.de
If you has any ideo how to solve this problem you can tell me :)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Put text into fld at a website

Post by FourthWorld » Thu Feb 18, 2016 7:26 pm

Do you want to display the value in the browser, or is the goal to submit that value to the server?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply