Required Field . . . How to?
There is incorrect line if (username '' email != '' || pass != ''). Here is a correct if (inputpass == '' && inputuser == '' &&inputemail == '') - just change the values names
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
There is incorrect line if (username '' email != '' || pass != ''). Here is a correct if (inputpass == '' && inputuser == '' &&inputemail == '') - just change the values names
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.
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');
}
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()
Hello! Your code looks correct. Do you have any problem with that? Could you clarify your question please?
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?
Where else you call the function except page load?
See below
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).