Page 3 of 4

Required Field . . . How to?

Posted: Thu Oct 18, 2012 2:09 pm
by Maryna Brodina

There is incorrect line if (username '' email != '' || pass != ''). Here is a correct if (inputpass == '' && inputuser == '' &&inputemail == '') - just change the values names


Required Field . . . How to?

Posted: Thu Oct 18, 2012 2:14 pm
by Kevin

Hi Clinton,

Your code looks incomplete:
This is the complete code that has worked for me:

precode

function checkInputs(){
var field1 = Tiggr('field1name').val();
var field2 = Tiggr('field2name').val();
var field3 = Tiggr('field3name').val();
var field4 = Tiggr('field4name').val();
var button = Tiggr('buttonname');

if (field1 == '' field2 == '' field3 == '' || field4 == '') {
button.addClass('ui-disabled');
}

else {
button.removeClass('ui-disabled');
}}

checkInputs()

/code/pre

Place the above code on every input field (on value change custom JS) that you want the user to fill before the button becomes enabled.


Required Field . . . How to?

Posted: Thu Oct 18, 2012 2:23 pm
by Clinton

Sorry. Like I mention in my comments above I didn't realize my operators were a mess. It did work, here was my complete code in the end

var username = Tiggr('txtRegUsername').val();
var email = Tiggr('txtRegEmail').val();
var pass = Tiggr('txtRegPass').val();
var cpass = Tiggr('txtRegConfirmPass').val();
var button = Tiggr('btnReg');

if (username == '' email == '' pass == '' || pass != cpass){
button.addClass('ui-disabled');
}
else {
button.removeClass('ui-disabled');
}


Required Field . . . How to?

Posted: Wed Jul 10, 2013 7:44 pm
by George Van Wormer5962866

Do you have to do anything to get the button enabled again or should the java handle that?

var button = Tiggr('Submiteventbutton');
button.addClass('ui-disabled');

Something to counter that at load?

Also, is field1 referring to the name under the common tab?

This is how my code looks:

function checkInputs() {
var eventnameInput = Tiggr('eventnameInput').val();
var eventStartDateInput = Tiggr('eventStartDateInput').val();
var intervalSelector = Tiggr('intervalSelector').val();
var Submiteventbutton = Tiggr('Submiteventbutton');
if (eventnameInput == '' eventStartDateInput == '' intervalSelector == '') {
button.addClass('ui-disabled');
}
else {
button.removeClass('ui-disabled');
}}
chechInputs()


Required Field . . . How to?

Posted: Wed Jul 10, 2013 8:02 pm
by Maryna Brodina

Hello! Your code looks correct. Do you have any problem with that? Could you clarify your question please?


Required Field . . . How to?

Posted: Wed Jul 10, 2013 8:14 pm
by George Van Wormer5962866

The page loads correctly but after I enter the info into the required fields inputs, the submit button doesn't enable. Could it be because one of the required fields is a date/time?


Required Field . . . How to?

Posted: Wed Jul 10, 2013 8:47 pm
by Maryna Brodina

Where else you call the function except page load?


Required Field . . . How to?

Posted: Wed Jul 10, 2013 8:53 pm
by George Van Wormer5962866

See below


Required Field . . . How to?

Posted: Wed Jul 10, 2013 8:55 pm
by George Van Wormer5962866

These are all the events happening on this page.

Image

Image

After the information is created, it is stored in the appery database and sent to an outside service. Event info is then displayed the dashboard screen from a read service (pulled from appery database).


Required Field . . . How to?

Posted: Wed Jul 10, 2013 9:20 pm
by Maryna Brodina

Looks like you have errors in code...
1) code var Submiteventbutton = Tiggr('Submiteventbutton');/code then you do codebutton.addClass('ui-disabled');/code so your variable's referring to button Submiteventbutton, but you use button which is not defined
2) You have function checkInputs, but you call chechInputs (there is a typo).