Pravee7094 Active Member Jul 12, 2021 #1 Hi all, we are making a small website using b4j and html. Doubt is, In B4j we just add this feature such as If I click the delete button, the alert box will appear. In that alert box, there is yes or no question (Are you sure want to delete ? ). I think all of them know this feature. Here my sample code : B4X: Copy Dim str As String str = $" $(function(){ if (confirm("Are you sure want to Delete?")) { return true; } return false; }); "$ is_websocket.Eval(str,Null) In that above code, If action is true the delete operation done here. Delete code is here, B4X: Copy sql1.ExecNonQuery2("delete from gl_uom where uompk = ? ", Array As Object(ls_uompk)) How can I insert the b4j code into the js code ? I want this deletion code instead of this "return true; " code. Any suggestion or Help? or Any other relevant code is available for html pages with b4j ? Regards Praveen
Hi all, we are making a small website using b4j and html. Doubt is, In B4j we just add this feature such as If I click the delete button, the alert box will appear. In that alert box, there is yes or no question (Are you sure want to delete ? ). I think all of them know this feature. Here my sample code : B4X: Copy Dim str As String str = $" $(function(){ if (confirm("Are you sure want to Delete?")) { return true; } return false; }); "$ is_websocket.Eval(str,Null) In that above code, If action is true the delete operation done here. Delete code is here, B4X: Copy sql1.ExecNonQuery2("delete from gl_uom where uompk = ? ", Array As Object(ls_uompk)) How can I insert the b4j code into the js code ? I want this deletion code instead of this "return true; " code. Any suggestion or Help? or Any other relevant code is available for html pages with b4j ? Regards Praveen
Erel B4X founder Staff member Licensed User Longtime User Jul 12, 2021 #2 Pravee7094 said: How can I insert the b4j code into the js code ? Click to expand... The js code runs on the browser. It cannot run your B4J code and it cannot directly access the server database. You can use b4j_raiseevent to raise an event on the server: https://www.b4x.com/android/forum/pages/results/?query=b4j_raiseEvent Upvote 0
Pravee7094 said: How can I insert the b4j code into the js code ? Click to expand... The js code runs on the browser. It cannot run your B4J code and it cannot directly access the server database. You can use b4j_raiseevent to raise an event on the server: https://www.b4x.com/android/forum/pages/results/?query=b4j_raiseEvent