Blueforcer Well-Known Member Licensed User Longtime User Apr 10, 2018 #1 Hello, i added the ABMInput in Class_Globals Code: Dim inpText As ABMInput Then i add the Component to the page with Code: inpText.Initialize(page,"inpText",ABM.INPUT_TEXT,"Text",False,"") page.Cell(7,2).AddComponent(inpText) But with inpText.text i always get an empty String. What is the correct way to get the entered text?
Hello, i added the ABMInput in Class_Globals Code: Dim inpText As ABMInput Then i add the Component to the page with Code: inpText.Initialize(page,"inpText",ABM.INPUT_TEXT,"Text",False,"") page.Cell(7,2).AddComponent(inpText) But with inpText.text i always get an empty String. What is the correct way to get the entered text?
alwaysbusy Expert Licensed User Longtime User Apr 10, 2018 #2 Don't declare ABMInput in globals, just where you create it. Then use .Component() when you use it (like you want to get the .Text). The reason for that is because .Component() does more than just 'getting' the components java object, it also syncs the java object with the html object in the browser. So in short: in connectPage() or wherever you add it to the page: Code: ... Dim inpText As ABMInput inpText.Initialize(page,"inpText",ABM.INPUT_TEXT,"Text",False,"") page.Cell(7,2).AddComponent(inpText) ... In e.g. a button click (or where you want to get the current text back): Code: ... Dim inpText As ABMInput = page.Component("inpText") ' syncs the ABMInput object with the browsers value log(inpText.Text) ... Upvote 0
Don't declare ABMInput in globals, just where you create it. Then use .Component() when you use it (like you want to get the .Text). The reason for that is because .Component() does more than just 'getting' the components java object, it also syncs the java object with the html object in the browser. So in short: in connectPage() or wherever you add it to the page: Code: ... Dim inpText As ABMInput inpText.Initialize(page,"inpText",ABM.INPUT_TEXT,"Text",False,"") page.Cell(7,2).AddComponent(inpText) ... In e.g. a button click (or where you want to get the current text back): Code: ... Dim inpText As ABMInput = page.Component("inpText") ' syncs the ABMInput object with the browsers value log(inpText.Text) ...