I've had pretty good luck doing it this way.  Below are the important
snippets of code.  I've left off the actual checking code since that is very
specific to my application.  You can see it in action here:
http://www.area50four.com/signup

>From the Signup page:

<div id="validationHolder"></div>
<?php echo $html->input("User/username", array('onChange' =>
'validateUsername(this.value)')); ?>

<script>
function validateUsername(username)
{
        new Ajax.Updater('validationHolder', '/users/checkUsername/' +
username, { evalScripts : true });
}
</script>

--------
The entire check_username.thtml:
<?php if ($isinvalid): ?>
<script type="text/javascript">
        alert('Your username contains invalid characters.  It can only
contain alphanumeric characters and the underscore. It cannot contain
spaces.  For example: A-Z, 0-9 and _');
        $('UserUsername').focus();
</script>
<?php elseif ($isuser): ?>
<script type="text/javascript">
        alert('The username you have entered has already been taken.  Please
choose another.');
        $('UserUsername').focus();
</script>
<?php endif; ?>


-----Original Message-----
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Anoop
Sent: Friday, December 07, 2007 8:42 AM
To: Cake PHP
Subject: Username availabilty check


Hi All ,

Can anyone provide me a username availability check script using ajax
helper of cake php.. I am facing the problem that in ajax->link I am
not able to get the username , the user just placed into the form.

<?php echo $ajax->link('check',"Check",array( 'url'=>"/registration/
checkUserExists/", 'update'=>"user_exist"));?>

How can I include the username the user entered recently to the url??

Please help..Very urgent

Thanks in advance
Anoop


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to