Some suggestion or little sample?
I've try all the possible combination..
thanks
Fabio
Some suggestion or little sample?
I've try all the possible combination..
thanks
Fabio
possible that the PRG should be in the folder:
C:\lianja\cloudserver\tenants\public\wwwroot\libra ry?
I put it there and, as firefox, if I enter:
http://localhost:8001/library/dws_ge...earchTable.org
I get:
file: file.html
so I changed my file to dws_getResultSearchTable.prg
[Code]
?? [<Table width = "100%" height = "10%" cellpadding = "5" cellspacing = "2" bgcolor = "white" border = 2px id = "table">]
?? [<Tr bgcolor = "gray">]
?? [<Td align = "center" colspan = "3">]
?? [</ Td>]
?? [</ Tr>]
?? [<Tr bgcolor = "# eaeaea">]
?? [<Tr bgcolor = "& rowcolor" class = "datacellgridline">]
............
..
.
[/ Code]
and on firefox I get my nice HTML page ..
therefore, the folder "Desktop webservice" is actually "library"?
Now ... how do I use getUrl to populate my WebView?
does not work..Code:READTEXT function () {Window.alert ( "ReadText"); result = Lianja.getUrl ( "http://localhost:8001/library/dws_getResultSearchTable.prg"); window.alert (result); divTabella var = document.getElementById ( "DivTabella"); divTabella.innerHTML = result ; };
reading here:
I understood that if the prg returns: "file: file.html", then my variable "result" would be a string with the contents of the file "file.html" ..Your service may return a JSON encoded object (as shown above), an XML string, string an HTML or plain text.
If the result returned starts with "file:" then the file specified e.g. "File: mytempfile.txt" is read and the result is sent back to the client. This Provides the ability to query large Amounts of information not limited by internal string length.
where am I wrong?
I've try with port 8001 and 8002..
thank you
Last edited by phabio; 2016-03-17 at 09:48.
Hi Fabio,
This is not really the method that has been discussed so far, but might work for what you want to do:
Note: file.htm is in the App. There are various attributes you can set on the iframe.Code:<%@ Language=VFP %> <html> <head> </head> <body> <button id=test" type="button" onclick="readText()">Test</button> <div id="DivTabella"> Click Test </div> <script type='text/javascript'> function readText() { window.alert("ReadText"); document.getElementById("DivTabella").innerHTML ='<iframe src="http:/localhost:8002/file.html" width="100%" height="100" scrolling="no" frameborder="0"></iframe>'; }; </script> </body> </html>
Regards,
Yvonne
just fantastic ..
Thanks Yvonne, too many parameters .. and without even an example, I would have never arrived ...
Just finished writing the whole thing.
Thanks again
Fabio
Only one problem left...
in my HTML file I've a row like this:
Now, the "filterComments" js function are never called...Code:<td> <input width="100%" type="text" value="" id="cod_art" onchange="filterComments('Z')" > </td> <td> <input width="100%" type="text" value="" id="catmercgam" onchange="filterComments('Z')" > </td> <td> <input width="100%" type="text" value="" id="des_web" onchange="filterComments('Z')" > </td>
it's because now are all inside a "iframe"?
thanks
Fabio
In the HTML you generate into the iframe you can reference functions in the parent like this.
window.parent.filterComments('Z')
You can get a reference to the Lianja system object in the parent like this then use it in an iframe:
window.Lianja = window.parent.Lianja;
You can now reference all UI objects in the WebView.
Principal developer of Lianja, Recital and other products
Follow me on:
Twitter: http://twitter.com/lianjaInc
Facebook: http://www.facebook.com/LianjaInc
LinkedIn: http://www.linkedin.com/in/barrymavin
Thans Barry, I try later..
no... do not work..
this is the body:
this is the filterComments js functionCode:<body onload="filterComments('X');"> <% proc drawTable() ? ('<p id="Query">' + '</p>') ? ('<div id="DivTabella" title="Tabella">') ? ('</div>') // list html off &m_fields onclick m_target,"selectitem('{}')" endproc drawTable() %> </body>
and this the first row of my table..Code:function filterComments(m_empty) { var search_str; var data = "&m_fields"; var dataquery = "&m_query"; var table = "&m_table"; var cursor = "&m_cursor"; var caption = "&m_caption"; var target = "&m_target"; var execute = ""; var datasets = []; var querysets = []; var i; var value; var query = ""; var valore; window.alert("FilterComments"); if (data.indexOf(",") > 0) { datasets = data.split(","); querysets = dataquery.split(","); for (i=0; i<datasets.length; ++i) { value = datasets[i]; if (m_empty == "X") { valore = ""; valore = querysets[i]; } else { valore = document.getElementById(value).value ; }; query = query + ";" + value + "|" + valore; } query = query.substr(1); document.getElementById('Query').innerHTML = 'Query = select ' + table + " where " + query; execute = 'sup_Search_sectionRefresh("' + table + '","' + cursor + '","' + query + '","' + caption + '","' + target + '")'; var innerHTML = Lianja.evaluate(execute); window.alert("Call read text"); document.getElementById("DivTabella").innerHTML ='<iframe src="http:/localhost:8002/' + innerHTML + '" width="100%" height="90%" scrolling="yes" frameborder="0"></iframe>'; } else { Lianja.showMessage("Criteri non configurati correttamente"); return; } };
if I put filterComments inside the file .. something works the filterComments function is called, but then it does not work .. maybe because it fails referencing variables ..Code:<table width="100%" height="10%" cellpadding="5" cellspacing="2" bgcolor="white" border=2px id="tabella"> <tr bgcolor="gray"> <td align="center" colspan="3"> </td> </tr> <tr bgcolor="#eaeaea"> <tr bgcolor="&rowcolor" class="datacellgridline"> <td valign=top align=left> <b> Articolo </td> </b> <td valign=top align=left> <b> Cat. merc. </td> </b> <td valign=top align=left> <b> Descrizione </td> </b> </tr> <td> <input width="100%" type="text" value="" id="cod_art" onchange="window.parent.filterComments('Z')" > </td> <td> <input width="100%" type="text" value="" id="catmercgam" onchange="window.parent.filterComments('Z')" > </td> <td> <input width="100%" type="text" value="" id="des_web" onchange="window.parent.filterComments('Z')" > </td> </tr>
Can be the "div" in the Body the problem?
thanks again
Fabio
Hi Fabio,
With the filterComments function inside the html file, when it fails, right-click in the WebView Section and choose 'Inspect' and see what the error being returned is.
Regards,
Yvonne
With funcion inside at the file, not see the variable "&m_fields"..
With the solution proposed from Barry, the function should remain in the RSP file, butCode:function filterComments(m_empty) { var search_str; var data = "&m_fields"; var dataquery = "&m_query"; var table = "&m_table"; var cursor = "&m_cursor"; var caption = "&m_caption"; var target = "&m_target"; var execute = ""; var datasets = []; var querysets = []; var i; var value; var query = ""; var valore; window.alert("FilterComments"); if (data.indexOf(",") > 0) { window.alert("Data ok"); datasets = data.split(","); querysets = dataquery.split(",");
<input width="100%" type="text" value="" id="catmercgam" onchange="window.parent.filterComments('Z')" >
not work.
Bookmarks