I am using WordPress for the site and have added a user registration form on the front end however I am using the value attribute to populate it with pre defined text before the user clicks in the box.
However I need the form to not submit unless the user has clicked in the username box and filled in a username of there choice so it changes the default wording what was in there.
So far I am using
if ( !$userdata['user_login'] )
$error = __('A username is required for registration.', 'frontendprofile');
elseif ( username_exists($userdata['user_login']) )
$error = __('Sorry, that username already exists!', 'frontendprofile');
Which checks if a username has been populated but because I have a default value in here already then this validation isn’t working so is there a way to change this so the form wont submit unless the username has changed from the defualt value
There are many ways you could work around this. One could be to check the submitted value. E.g. (Assuming the “defaultValue” is an illegal user_login)
Note: PHP also has an empty function already. This is just an example method.
You should add in Javascript Validation to check the fields & I’m assuming you are already protecting yourself from SQL injection etc.
Hope this helps