B4J Question [BANanoVuetify] Get text from multiple VMTextFields on one Card

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
How can I get texts from multiple VMTextFields on one VMCard by pressing the Save button? and this VMCard is in a VMStepper

1589053058059.png

Note that the VMCard is located on a VMStepper.
Thank you!
Johan
 

Mashiane

Expert
Licensed User
Longtime User
Well, now that you have not included your example project...

Seeing this, its based on the autocomplete example in BVMDemo.

Can I please refer you back there. Check the code of Card_3. There we define a card and add components in it using Card.Container.AddComponent

That is the easier way.

1. Define the card as a global variable.

B4X:
private Card As VMCard

2. Create the card. Ensure your text boxes have defined vmodels.

B4X:
card = vm.CreateCard("card3", Me)
Card.Container.AddRows(1).AddColumns(3,12,12,12,12)
...

3. On button click

B4X:
dim rec as map = card.container.getdata

rec will return all input component values with vmodels as keys.

You can also just use

B4X:
dim sname as string = vm.getdata("firstname")

assuming you have a text field with a vmodel of firstname anywhere on your page.

Ta!

PS: A card acts like like a dialog box so the code that applies to the dialog will apply.
 
Upvote 0
Top