Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

A new TextInput form erases the value of the previous TextInput

I have this script:

[Prepare Phase]

var.p1 = 0
var.p2 = 0
# a 10x10 form
form1 = Form(cols=[1,1,1,1,1,1,1,1,1,1], rows=[1,1,1,1,1,1,1,1,1,1])
#setting input
text_input1 = TextInput(
		 frame=True, center=False, stub=u'Escribe aquí …',
		return_accepts=True,  var=u'cantidad_sujeto_1') #this var gets erased
form1.set_widget(text_input1, (3, 7), colspan = 4, rowspan = 3)


#setting image
image = ImageWidget(path=pool['1.png'],  adjust=True, frame=False)
form1.set_widget(image, (3, 1), colspan = 4, rowspan = 4)
#setting text
label = Label(text=u'¿Cuanto compartirias con el?', frame=False, center=True)
form1.set_widget(label, (4,6), colspan = 2, rowspan = 1)

#the second form

# a 10x10 form
form2 = Form(cols=[1,1,1,1,1,1,1,1,1,1], rows=[1,1,1,1,1,1,1,1,1,1])
#setting input


text_input2 = TextInput(
		 frame=False, center=False, stub=u'Escribe aquí …',
		return_accepts=True, var=u'cantidad_sujeto_2') #this var makes it to the logger 


form2.set_widget(text_input2, (3, 7), colspan = 4, rowspan = 3)
#setting image
image = ImageWidget(path=pool['2.png'],  adjust=True, frame=False)
form2.set_widget(image, (3, 1), colspan = 4, rowspan = 4)
#setting text
label = Label(text=u'¿Cuanto compartirias con el?', frame=False, center=True)
form2.set_widget(label, (4,6), colspan = 2, rowspan = 1)

[Run Phase]

if var.sujeto == 1:
	form1._exec()
	var.p1 = var.cantidad_sujeto_1 # this var always is 0
if var.sujeto == 2:
	form2._exec()
	var.p2 = var.cantidad_sujeto_2 #this var makes it


What this does is shows 2 different forms in a sequence. Each one with an Image, a text, and an TextInput.

When a variable like 'cantidad_sujeto_2' is submitted (the second form) , it erases the value of the previous TextInput 'cantidad_sujeto_1'.


I tried to store the value in another variable ([p1], [p2]) when the form is submitted (see Run Phase) but it is worthless.

What can i do?

Sign In or Register to comment.