Jump to content

UniURLFrame and Elements


vlkc

Recommended Posts

Guest tendon

Can somebody explain how to work with UniURLFrame? How to get elements name or id in UniURLFrame? How to set text in UniURLFrame?

 

Thanks

 

Did you try this?...

 

 MyUniURLFrame.URL := 'http://unigui.com'

Link to comment
Share on other sites

Did you try this?...

 

 MyUniURLFrame.URL := 'http://unigui.com'

 

 

I know this, but the question was - How to get elements name or id in UniURLFrame? How to set text in UniURLFrame?

Link to comment
Share on other sites

Guest tendon

I know this, but the question was - How to get elements name or id in UniURLFrame? How to set text in UniURLFrame?

 

Not sure I understand the question fully. Does this help?...

 

UniUrlFrame.ExtControl.GetId 

Link to comment
Share on other sites

I will try to explain.

 

Here is the code :

<input type="text" class="inputtext" id="email" name="email" value="" onkeypress="formchange()" />

How can i extract name of input which id is email?

Link to comment
Share on other sites

  • Administrators

I will try to explain.

 

Here is the code :

<input type="text" class="inputtext" id="email" name="email" value="" onkeypress="formchange()" />

How can i extract name of input which id is email?

 

I really don't understand what you want to achieve.

 

Do you want to retrieve "id" of TUniUrlFrame? If yes for what purpose? Please explain your problem in more details.

Link to comment
Share on other sites

I have an UrlFrame with the id "myUrlFrame" and a "div" on it with the name "myTile3". To get the text of this element, I use the following code:

 

document.getElementById('myUrlFrame').contentWindow.document.getElementById('myTile3').firstChild.data;

 

But the server and port must be exactly the same; Browsers deny access for security reasons, if you use another servername or port.

Link to comment
Share on other sites

  • Administrators

I have an UrlFrame with the id "myUrlFrame" and a "div" on it with the name "myTile3". To get the text of this element, I use the following code:

 

document.getElementById('myUrlFrame').contentWindow.document.getElementById('myTile3').firstChild.data;

 

But the server and port must be exactly the same; Browsers deny access for security reasons, if you use another servername or port.

 

OK. I understand him now. Yes above code is the only way to retrieve info from an embedded iframe.

In uniGUI iframe id is "iframe_"+(Delphi Name)

 

Conisder you have UniUrlFrame1 on Form. Its web id is iframe_UniUrlFrame1

Link to comment
Share on other sites

document.getElementById('UrlFrame_id').contentWindow.document.getElementById('input_id').value="test text";

 

You must replace UrlFrame_id and input_id with proper real ids.

 

How to do this on Unibutton1.click ?

Link to comment
Share on other sites

  • Administrators

How to do this on Unibutton1.click ?

 

Server side:

 

uses ...uniGUIAplication,

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
 UniSession.AddJS(' your JS code');
end;

 

Client side:

 

function OnClick(sender, e)
{
your code here
}

 

See our demos for client side scripting.

Link to comment
Share on other sites

I have an UrlFrame with the id "myUrlFrame" and a "div" on it with the name "myTile3". To get the text of this element, I use the following code:

 

document.getElementById('myUrlFrame').contentWindow.document.getElementById('myTile3').firstChild.data;

 

But the server and port must be exactly the same; Browsers deny access for security reasons, if you use another servername or port.

 

 

Is there another way to open up the website and put text into input? without restrictions...

Link to comment
Share on other sites

What is your purpose for doing this? Why users simply don't type into those fields?

 

Purpose is automaticaly fill and read web forms. In delphi the is a component Twebbrowser which perfectly does this work. there is only one problem, not all of users are using Windows.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...