Can not check multiple native inputbox (Android)

Hi all,

I need a little help with this i want to check if various input fields empty and if the text inside are less than two characters, but is not working, only check one input, not all the others four. how i can do this?

This is my code:

function checkcampos() if string.len(nombreinput.text) and string.len(apellidosinput.text) and string.len(diasemanainput.text) and string.len(mesestamosinput.text) and string.len(diadelmesinput.text) and string.len(estacioninput.text) \< 2 then print ("youmust") sound:play( "youmust" ) native.showAlert("demo", "you must complete all the fields!",{ "ok"}) else print ("completed!") sound:play( "completed!" ) local alert = native.showAlert( "demo", "Very good all the fields are complete!", { "restart","main menu" }, ifallok ) end end

Another alternative but only check one input, not if one of the input are empty and the other not:

function checkcampos() if nombreinput.text and apellidosinput.text and diasemanainput.text and mesestamosinput.text and diadelmesinput.text and estacioninput.text == "" then print ("youmust") sound:play( "youmust" ) native.showAlert("demo", "you must complete all the fields!",{ "ok"}) else print ("completed!") sound:play( "completed!" ) local alert = native.showAlert( "demo", "very good all the fields are complete!", { "restart ","main menu" }, ifallok ) end end

I know how to check one input but not how to check multiple inputs and return a message for all of them.

Thanks!

You need to write your first example like this:

[lua]

if string.len(nombreinput.text)<2 and string.len(apellidosinput.text)<2 and string.len(diasemanainput.text)<2 and string.len(mesestamosinput.text)<2 and string.len(diadelmesinput.text)<2 and string.len(estacioninput.text) < 2 then

[/lua]

Thanks elbowroomapps for your time on answer this :wink:

You need to write your first example like this:

[lua]

if string.len(nombreinput.text)<2 and string.len(apellidosinput.text)<2 and string.len(diasemanainput.text)<2 and string.len(mesestamosinput.text)<2 and string.len(diadelmesinput.text)<2 and string.len(estacioninput.text) < 2 then

[/lua]

Thanks elbowroomapps for your time on answer this :wink: