Stavros
Posts: 0
Joined: Wed Nov 14, 2012 1:34 pm

Checking for empty input on mobiletextinput

What is the JS to put on the click event of a button in order not to go forward if the user ommits to enter his/her name, number into two mobiletextinput of type text and number? Maybe something like

var name = Tiggr('mobiletextinput1').val();
var number = Tiggr('mobiletextinput2').val();

if (name != ' ' || number != ' '){
alert ('Please enter you name number');
return;
}

and then put a Navigate to page action

It does not work for me...

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Checking for empty input on mobiletextinput

It looks right.. but you need to debug the JavaScript. Check first what you get in 'name' and 'number'. You can use console.log(name); -- for example.

Martin Davis
Posts: 0
Joined: Mon Mar 18, 2013 5:31 pm

Checking for empty input on mobiletextinput

Shouldn't the logic be:

if (name == '' || number == '') {
alert('error message of your choice');
}

???

And, then my question, is how do you add a "Navigate to page" action inside the JS?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Checking for empty input on mobiletextinput

Hi Martin,

This is the correct JavaScript code.

You can navigate to page using the following JavaScript code:
codenavigateTo('pageName');/code
where 'pageName' is a name of Tiggzi page.

Return to “Issues”