>
> I have a drop down list consisting of 'status' values. Each city has
> its own id and and a set of colors for it.
> Below is my requirement :
> 1. If a user selects a 'status' value from the drop down, I have to
> ask the user "if he/she is confirmed with the selected status".
> 2. If 'no' nothing should happen
> 3. If "yes", I should get the values of colors associated with that
> particular status.
> 4. All the above should happen WITHOUT reloading the page.
>
> color values are stored in mysql database.
>
> How to acheive this using cakePHP?
> Please help me in this.
This would be very easy using jQuery. Just include the library along
with something like the following:
$(function()
{
$('#id_of_your_select').change(function()
{
var status = $(this).val();
if (confirm('your confirmation message'))
{
$.ajax({
url: '/path/to/controller/action',
data: 'status='status,
success:
function(html)
{
// do something with returned color data
}
});
}
});
});
The above could be saved to a separate file and included in the view like so:
echo $javascript->link('jquery.min', false);
echo $javascript->link('some_file_name', false);
If you'd rather pass the status as an action parameter, leave out the
'data' option and change url to:
url: '/path/to/controller/action/' + status
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment