August 11, 201510 yr The following code in a web viewer produce a response like "errno=0&desc=SMS Queued&SmsIndex=34", how to get it in to a filemaker field? I Nead to get it without plug in, it should work also for the IOS platform. Many thank for your help. <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'><html> <head> <script> function post(path, params) { method = 'post'; var form = document.createElement('form'); form.setAttribute('method', method); form.setAttribute('action', path); for(var key in params) { if(params.hasOwnProperty(key)) { var hiddenField = document.createElement('input'); hiddenField.setAttribute('type', 'hidden'); hiddenField.setAttribute('name', key); hiddenField.setAttribute('value', params[key]); form.appendChild(hiddenField); } } document.body.appendChild(form); form.submit();} </script> </head> <body onload="post('http://192.168.1.99/smssend.cgi' {Pwd: '1234','Push': 0, num: '335xxxx', text:'My sms machine Text'})"> </body></html>
August 11, 201510 yr First you need to grab the content of the web viewer. Use GetLayoutObjectAttribute() for that. You'll also want to check that the page has finished loading by ensuring the </html> tag is present. Then you'll want to find the position of both the onload=" string the the subsequent close brackets. There are several functions that you'll probably want to use: Let(), PatternCount(), Position(), and Middle().
August 11, 201510 yr Author i already tested GetLayoutObjectAttribute(), it give me only the html page without the result of the "<body onload=......" function. This is the tipycal text result ".....errno=0&desc=SMS Queued&SmsIndex=34...", i need to grab this text coming out from the sms hardware machine. this is what i get using GetLayoutObjectAttribute() with option "content": <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'><html> <head> <script> function post(path, params) { method = 'post'; var form = document.createElement('form'); form.setAttribute('method', method); form.setAttribute('action', path); for(var key in params) { if(params.hasOwnProperty(key)) { var hiddenField = document.createElement('input'); hiddenField.setAttribute('type', 'hidden'); hiddenField.setAttribute('name', key); hiddenField.setAttribute('value', params[key]); form.appendChild(hiddenField); } } document.body.appendChild(form); form.submit(); } </script> </head> <body onload="post('http://192.168.1.99/smssend.cgi' {Pwd: '1234','Push': 0, num: '335xxxx', text:'My sms machine Text'})"> </body></html> Edited August 11, 201510 yr by Franco Pagano
August 11, 201510 yr GetLayoutObjectAttribute() accesses the HTML code passed to the web-viewer, not the DOM (same as View Page Source does in a regular browser). You might have more luck using the Insert From URL[] script step:http://www.filemaker.com/help/14/fmp/en/html/scripts_ref1.35.50.html#1144726 Or perhaps try the fmp:// protocol to send the values back to Filemaker:http://www.filemaker.com/help/14/fmp/en/html/sharing_data.17.6.html Edited August 11, 201510 yr by comment
August 11, 201510 yr Author i don't know how to transform the Dom text to a variable to send to filemaker using the fmp:// protocol. about Insert From URL[] the post doesn't work with the sms machine hw, i have to use the javascript. Thanks for your attentions
August 11, 201510 yr i don't know how to transform the Dom text to a variable I believe that's a javascript question.
August 11, 201510 yr Author some time the solution are so simple: Select the the web viewer object Copy the selection paste into the destination field. Old filemaker style.
Create an account or sign in to comment