TomDuncan Active Member Licensed User Longtime User Jul 7, 2021 #1 Hi All I have this code in my index.html B4X: Copy <div id="maindiv"> .. lots of stuff . then this button to show a modal (using bootstrap 3) <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Small Modal</button> .. then modal here </div> If I run this with a websocket program all is fine. The modal open etc. However if I place .. B4X: Copy Sub maindiv_click (Params As Map) 'find the target element If Params.IsInitialized Then Dim target As String = Params.Get("target") Log(target) End If End Sub in the Websocket area. I do get which button has been pressed but the action is not been picked up in the html. My idea is how can I send the OnClick event from the server to initiate the onClick. Thanks Tom
Hi All I have this code in my index.html B4X: Copy <div id="maindiv"> .. lots of stuff . then this button to show a modal (using bootstrap 3) <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Small Modal</button> .. then modal here </div> If I run this with a websocket program all is fine. The modal open etc. However if I place .. B4X: Copy Sub maindiv_click (Params As Map) 'find the target element If Params.IsInitialized Then Dim target As String = Params.Get("target") Log(target) End If End Sub in the Websocket area. I do get which button has been pressed but the action is not been picked up in the html. My idea is how can I send the OnClick event from the server to initiate the onClick. Thanks Tom
Erel B4X founder Staff member Licensed User Longtime User Jul 7, 2021 #2 Try this: Code: Copy Button.RunMethod("trigger", Array("click")) Upvote 0
TomDuncan Active Member Licensed User Longtime User Jul 7, 2021 #3 I tested this out and got an endless loop of the button being clicked.. B4X: Copy Dim button As JQueryElement = ws.GetElementById("edit_11") button.RunMethod("trigger", Array("click")) Upvote 0
I tested this out and got an endless loop of the button being clicked.. B4X: Copy Dim button As JQueryElement = ws.GetElementById("edit_11") button.RunMethod("trigger", Array("click"))
Erel B4X founder Staff member Licensed User Longtime User Jul 7, 2021 #4 Try this: https://api.jquery.com/triggerHandler/ Upvote 0
DonManfred Expert Licensed User Longtime User Jul 7, 2021 #5 TomDuncan said: Dim button As JQueryElement = ws.GetElementById("edit_11") Click to expand... Based on the html code above there is no object with this ID. Did you define a ID with this button? Upvote 0
TomDuncan said: Dim button As JQueryElement = ws.GetElementById("edit_11") Click to expand... Based on the html code above there is no object with this ID. Did you define a ID with this button?
TomDuncan Active Member Licensed User Longtime User Jul 7, 2021 #6 Yes I did. This was returned as a target in the maindiv event. Upvote 0