R RB Smissaert Well-Known Member Licensed User Longtime User Nov 3, 2019 #1 This is the webpage I am dealing with: https://qrisk.org/three/index.php Managed now to populate all the controls properly, but having problems submitting the form, so pressing the Calculate risk button. Tried many variations, but it seems this should do it: Code: Javascript = "document.forms.calculator.submit();" WebViewExtras1.executeJavascript(WebView1, Javascript) But it doesn't, just sets all the controls to blank. This is the html related to that button: Code: </fieldset> </fieldset> </fieldset> <input type='submit' value='Calculate risk' name="calculate"> </form> </TD> <TD> <h4>The QRISK<sup>®</sup>3 algorithm</h4> Any suggestions how this should be done? RBS
This is the webpage I am dealing with: https://qrisk.org/three/index.php Managed now to populate all the controls properly, but having problems submitting the form, so pressing the Calculate risk button. Tried many variations, but it seems this should do it: Code: Javascript = "document.forms.calculator.submit();" WebViewExtras1.executeJavascript(WebView1, Javascript) But it doesn't, just sets all the controls to blank. This is the html related to that button: Code: </fieldset> </fieldset> </fieldset> <input type='submit' value='Calculate risk' name="calculate"> </form> </TD> <TD> <h4>The QRISK<sup>®</sup>3 algorithm</h4> Any suggestions how this should be done? RBS
Erel B4X founder Staff member Licensed User Longtime User Nov 4, 2019 #2 Why use WebView at all? Why not send the request with OkHttpUtils2? Upvote 0
R RB Smissaert Well-Known Member Licensed User Longtime User Nov 4, 2019 #3 Erel said: Why use WebView at all? Why not send the request with OkHttpUtils2? Click to expand... Because I have a WebView running in the app at that time showing that web page and because I have never used OkHttpUtils2 and because it looks it should work with WebviewExtras. Thanks for that suggestion though and will have a look at OkHttpUtils2. RBS Upvote 0
Erel said: Why use WebView at all? Why not send the request with OkHttpUtils2? Click to expand... Because I have a WebView running in the app at that time showing that web page and because I have never used OkHttpUtils2 and because it looks it should work with WebviewExtras. Thanks for that suggestion though and will have a look at OkHttpUtils2. RBS
rraswisak Active Member Licensed User Longtime User Nov 4, 2019 #4 Change the javascript with this: Code: Javascript = $"document.getElementsByName("calculate")[0].click();"$ Upvote 0
Change the javascript with this: Code: Javascript = $"document.getElementsByName("calculate")[0].click();"$
R RB Smissaert Well-Known Member Licensed User Longtime User Nov 4, 2019 #5 rraswisak said: Change the javascript with this: Code: Javascript = $"document.getElementsByName("calculate")[0].click();"$ Click to expand... Thanks, will try that. RBS Upvote 0
rraswisak said: Change the javascript with this: Code: Javascript = $"document.getElementsByName("calculate")[0].click();"$ Click to expand... Thanks, will try that. RBS
R RB Smissaert Well-Known Member Licensed User Longtime User Nov 4, 2019 #6 rraswisak said: Change the javascript with this: Code: Javascript = $"document.getElementsByName("calculate")[0].click();"$ Click to expand... Have tested this now and it does indeed work. Thanks for that. RBS Upvote 0
rraswisak said: Change the javascript with this: Code: Javascript = $"document.getElementsByName("calculate")[0].click();"$ Click to expand... Have tested this now and it does indeed work. Thanks for that. RBS