Q Quillok Member Licensed User Longtime User Oct 18, 2018 #1 hello, I am currently playing with webviews, but fail to click a button. It is a simple html and php file, both limited to the most necessary, with an input field and a submit button. I can write into the field using webviewextras, but the button is not triggered. can someone possibly tell me why it fails? if i click the button manually, both in the browser and in the webview, the content of the window is normally sent by mail, but i try it programmatically it doesn't work :/ Following the B4A Code, the HTML Code and the PHP Code: Code: Copy Sub wv_PageFinished (Url As String) Dim Javascript As String Dim MyWebViewExtras As WebViewExtrasJavascript="document.forms.main.message.value='test1234';document.forms.main.submit();" MyWebViewExtras.executeJavascript(wv, Javascript) End Sub HTML: Copy <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>test</title> </head> <body> <header class="body"> </header> <section class="body"> <form id="main" method="post" action="index.php"> <label>Message</label> <textarea name="message" placeholder="Type Here"></textarea> <input id="submit" name="submit" type="submit" value="Submit"> </form> </section> <footer class="body"> </footer> </body> </html> PHP: Copy <?php $message = $_POST['message']; $from = 'From: test'; $to = '[email protected]'; $subject = 'test1234'; $body = "Message:\n $message"; if ($_POST['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>sent!</p>'; } else { echo '<p>not sent!</p>'; } } ?>
hello, I am currently playing with webviews, but fail to click a button. It is a simple html and php file, both limited to the most necessary, with an input field and a submit button. I can write into the field using webviewextras, but the button is not triggered. can someone possibly tell me why it fails? if i click the button manually, both in the browser and in the webview, the content of the window is normally sent by mail, but i try it programmatically it doesn't work :/ Following the B4A Code, the HTML Code and the PHP Code: Code: Copy Sub wv_PageFinished (Url As String) Dim Javascript As String Dim MyWebViewExtras As WebViewExtrasJavascript="document.forms.main.message.value='test1234';document.forms.main.submit();" MyWebViewExtras.executeJavascript(wv, Javascript) End Sub HTML: Copy <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>test</title> </head> <body> <header class="body"> </header> <section class="body"> <form id="main" method="post" action="index.php"> <label>Message</label> <textarea name="message" placeholder="Type Here"></textarea> <input id="submit" name="submit" type="submit" value="Submit"> </form> </section> <footer class="body"> </footer> </body> </html> PHP: Copy <?php $message = $_POST['message']; $from = 'From: test'; $to = '[email protected]'; $subject = 'test1234'; $body = "Message:\n $message"; if ($_POST['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>sent!</p>'; } else { echo '<p>not sent!</p>'; } } ?>