vlkc Posted April 5, 2012 Share Posted April 5, 2012 Can somebody explain how to work with UniURLFrame? How to get elements name or id in UniURLFrame? How to set text in UniURLFrame? Thanks Quote Link to comment Share on other sites More sharing options...
Guest tendon Posted April 5, 2012 Share Posted April 5, 2012 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' Quote Link to comment Share on other sites More sharing options...
vlkc Posted April 5, 2012 Author Share Posted April 5, 2012 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? Quote Link to comment Share on other sites More sharing options...
Guest tendon Posted April 5, 2012 Share Posted April 5, 2012 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 Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 5, 2012 Administrators Share Posted April 5, 2012 Next build will add HTML property to TUniUrlFrame which allows directly adding HTML content to UrlFrame. Quote Link to comment Share on other sites More sharing options...
vlkc Posted April 5, 2012 Author Share Posted April 5, 2012 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? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 5, 2012 Administrators Share Posted April 5, 2012 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. Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted April 5, 2012 Share Posted April 5, 2012 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. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 5, 2012 Administrators Share Posted April 5, 2012 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 Quote Link to comment Share on other sites More sharing options...
vlkc Posted April 5, 2012 Author Share Posted April 5, 2012 How to get this input ID Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 5, 2012 Administrators Share Posted April 5, 2012 How to get this input ID Use a tool like firebug to investigate its id. Quote Link to comment Share on other sites More sharing options...
vlkc Posted April 5, 2012 Author Share Posted April 5, 2012 OK i will try anotherway. How do i fill first input with text "test text"? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 5, 2012 Administrators Share Posted April 5, 2012 document.getElementById('UrlFrame_id').contentWindow.document.getElementById('input_id').value="test text"; You must replace UrlFrame_id and input_id with proper real ids. Quote Link to comment Share on other sites More sharing options...
vlkc Posted April 5, 2012 Author Share Posted April 5, 2012 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 ? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 5, 2012 Administrators Share Posted April 5, 2012 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. Quote Link to comment Share on other sites More sharing options...
vlkc Posted April 5, 2012 Author Share Posted April 5, 2012 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... Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 5, 2012 Administrators Share Posted April 5, 2012 Is there another way to open up the website and put text into input? without restrictions... What is your purpose for doing this? Why users simply don't type into those fields? Quote Link to comment Share on other sites More sharing options...
vlkc Posted April 5, 2012 Author Share Posted April 5, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.