I guess what you have to do is to make an ajax call to your controller
that will check in the DB and render a view.
This view will update the "availabity" div.

You can make an ajaxlink (in a button form) and send the fields (user
etc) using the option 'with'. If you have a form for entering your
user name already there you can send the form (using it's Id) to the
controller check function.

In your controller you check if the name exists and set a message
using $this->set('message', 'ok');
 your rendering view should look like this :

$ajax->div('Availability);
  echo '<h2>'.$message.'</h2>';
$ajax->dviEnd('availability');

Hope this helps

On Jun 14, 10:58 am, Unite <[EMAIL PROTECTED]> wrote:
> Hi. Im new to PHP and Cake PHP but a fast learner and learn by
> example.
>
> Heres the scenario.
> I am making a sign in system with the option to register.
> Everything is working 100% on both the sign in and register part. What
> I would like to do is add a button on the register page that when
> clicked displays a message if the user name exists or is available in
> a div tag.
>
> My current framework
>
> Model : models/user.php
> <?php
> class User extends AppModel {
>     var $name = 'User';}
>
> ?>
>
> Controller : controllers/users_controller.php
> // minus code
> <?php
> class UsersController extends AppController {
>         function login() { }
>         function logout() { }
>         function register() { }
>
> }
>
> View : views/users/register.thtml
> // Random HTML
>
> insert button 'Check' <div id = 'Availability'></div>
>
> So now how would I get that div to update when I press the button?
> Any help would be really appreciated.
> Thanks
> Wade


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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