I have an input form to create a customField name, when the page loads the textbox is automatically filled with "cst_".
I preset this value in my class:
class customField{
// DEFINE PROPERTIES
public $id = 0;
public $groupId;
public $name = 'cst_';
public $displayName;
public $type;
public $defaultValue;
public $required;
public $orderCount;
...
When I go to save the fields on my page, I check to make sure that the user has imputed more values than just leaving the "cst_"
I do this by simply:
// CHECK FOR ONLY "cst_"
if(strlen($customField->name > 4)){
// SAVE
$customField->save();
}else{ noticeSet(1,'PLEASE ADD NAME');noticeSet(1,strlen($customField->name));}
in my textbox I added cst_water hardness
however I get the error
PLEASE ADD NAME
18
I don't understand how it is failing at that if
statement
I've added a noticeSet
before the if
statement and it shows 18
.
Is there any better way to see if a user has added more than just "cst_"?