Addo Well-Known Member Licensed User Longtime User Aug 24, 2019 #1 i have this sub that executejavascript inside webview Code: Copy Dim Javascript As String Dim message As String message = EditText1.text Javascript=$"addmssage('samer', 'message');"$ 'Log(Javascript) WebViewExtras1.executeJavascript(WebView1, Javascript) but it seems i cannot inject the edittext1.text to javascript string how possible i can pass a string inside the javascript variable in this case ?
i have this sub that executejavascript inside webview Code: Copy Dim Javascript As String Dim message As String message = EditText1.text Javascript=$"addmssage('samer', 'message');"$ 'Log(Javascript) WebViewExtras1.executeJavascript(WebView1, Javascript) but it seems i cannot inject the edittext1.text to javascript string how possible i can pass a string inside the javascript variable in this case ?
DonManfred Expert Licensed User Longtime User Aug 24, 2019 #2 PassionDEV said: Dim message As String message = EditText1.text Click to expand... You defined a String but you don´t used it. Why? You are setting the commands fix in your code PassionDEV said: Javascript=$"addmssage('samer', 'message');"$ Click to expand... Edit to add: note that there must be a javascript function named addmssage already in your webpage.... Upvote 0
PassionDEV said: Dim message As String message = EditText1.text Click to expand... You defined a String but you don´t used it. Why? You are setting the commands fix in your code PassionDEV said: Javascript=$"addmssage('samer', 'message');"$ Click to expand... Edit to add: note that there must be a javascript function named addmssage already in your webpage....
Addo Well-Known Member Licensed User Longtime User Aug 24, 2019 #3 thanks for replay the addmssage function is already in the js file i have tried to pass the message variable like following without success Code: Copy Javascript=$"addmssage('samer', ${message});"$ Upvote 0
thanks for replay the addmssage function is already in the js file i have tried to pass the message variable like following without success Code: Copy Javascript=$"addmssage('samer', ${message});"$
DonManfred Expert Licensed User Longtime User Aug 24, 2019 #4 try Code: Copy Javascript=$"addmssage('samer', '${message}');"$ For any other issue you need to provide more infos. Does not work is the wrong info.. What exactly is the error you get? Make sure to enable a logging for any javascripterrors... Don´t know exactly how but i remember that i read something like that in the past. Try the forumsearch Upvote 0
try Code: Copy Javascript=$"addmssage('samer', '${message}');"$ For any other issue you need to provide more infos. Does not work is the wrong info.. What exactly is the error you get? Make sure to enable a logging for any javascripterrors... Don´t know exactly how but i remember that i read something like that in the past. Try the forumsearch
Addo Well-Known Member Licensed User Longtime User Aug 24, 2019 #5 i am so stupid now because i forget to wrap the variable with ' ' which makes the execution read message like a js function thank you for the correction i think i should drink more coffee Upvote 0
i am so stupid now because i forget to wrap the variable with ' ' which makes the execution read message like a js function thank you for the correction i think i should drink more coffee