HiI did start this code on another thread, so not sure if I should have carried on with the other thread or started a new, as its a slightly different question. So apologies if I should have done that. Here are my questions
1. If I create an element via a function, say a Column Panel or Text Box via code, I want to be able to reference that particular element in another function.
So, if I drag and drop a text box on the properties, I can rename it to something unique and reference that in my argument.
e.g self.repeating_panel_1.items = anvil.server.call('locationQuery', self.text_box_location.text)
But if I create one on a function, there doesnt seem to be a way of making it unique. This is how I am adding the component on the function
self.cp.add_component(self.tb, row=row, col_xs=3, width_xs=2)
How would I go about making each component unique, say traveller_1, traveller_2 etc?
2. If I am adding some components by drag and drop and others by a function, how do I specify the order of them as the one I created by a function is just showing up at the bottom of the page?
Is there any way I can look at an advanced tab that shows the whole page in code, so I can place the code for my created element where I want?
Like this:-
Drag and Drop Element
Drag and Drop Element
My Function Element
Drag and Drop
3. If thats not possible, how do I get my created element to display in a specific element
In my example self.tb (which is a textbox) I would like it to display this inside a drag and drop element named self.column_panel_all_travellers.
Here is my code
def text_box_travellers_pressed_enter(self, **event_args):
trav = int(self.text_box_travellers.text)
trav = trav + 1
traveller_ages=[]
for i in range(1, trav):
if i<=4:
row ='A'
elif 5<= i<=8:
row ='B'
elif 9<= i<12:
row ='C'
else:
row ='D'
self.tb = TextBox(bold= True,foreground="#FFF",background="#fff",placeholder=f"traveller{i}",)
self.tb.role = "form-control"
self.tb.tag.name = i
self.cp.remove_from_parent()
self.cp.add_component(self.tb, row=row, col_xs=3, width_xs=2)
self.add_component(self.cp)
pass
Here is the form, once you enter how many travellers, the boxes show at the bottom.
Thanks in advance