osdir.com
mailing list archive

Subject: Any chance to populate time-input fields with pre-defined values? - msg#01920

List: CakePHP

Date: Prev Next Index Thread: Prev Next Index

Hey,

I'm looking for a way to populate a time field (input, select) with
data I fetched from the database. This means, I have a specific time
period and I want to display only the times that are included in this
period (e.g. 08:00 - 16:00). This way, the user should chose times
like 12:15, 09:45, 14:30 and so on...

Is there ANY way to do this in Cake? I hope there is one, after this
I'll have to deal with putting these options via jQuery into the input
select and this won't be fun i guess...

Greetings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
cake-php+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

List leafs in Tree Behavior

Hello,I have a system with a Model behaving as Tree, the question is.I need to get a list of rows with out children meaning records that are leafs in the tree.Is there a way to accomplish that?Of course It is the "brute force method", but since the tree might be very large, I rather have a most efficient way. Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---

Next Message by Date: click to view message preview

Re: CakePHP & jQuery - Update multiple selects?

Browse through the posts here. There are tons of great tips. http://www.learningjquery.com/ On Sat, May 30, 2009 at 5:47 PM, DigitalDude <e.blumstengel@xxxxxxxxxxxxxx> wrote: > > Hey, > > THX for the response. I already changed my approach to the problem and > set up ID's for the elements and use .append to replace the options of > the elements. This works just finde, i encode my results to JSON and > jQuery rebuilds the list oft options for my selects the way it should. > > A question related to jQuery in general, are there any good sites or > tutorials or what I would call a function-overview for such purposes? > This would be great because it took a LOT of time to gather all > required information to my topic before I could solve it. > > Regards > > > On 30 Mai, 18:43, brian <bally.z...@xxxxxxxxx> wrote: >> This is solely due to jQuery (in fact, probably the source of most >> questions on its mailing list). >> >> The problem is that you're completely replacing each of the selects, >> rather than just the options. So, the event handlers you set up on the >> selects are no longer once the selects have been replaced. See here: >> >> http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st... >> >> Also, it doesn't appear that you have several sets of these 5 selects >> on a page because you're setting the event handlers using the element >> IDs (eg. '#BookingCountryId'). So, you might want to consider using an >> element id, rather than a class (eg. '.ajax_shop_id'), for the target >> to be updated. >> >> Or, don't bother and let jQuery find it using the select element itself: >> >> $('.ajax_page #BookingCountryId').change(function(){ >> Â Â Â Â var self = this; >> Â Â Â Â var selected = $(this).val(); >> Â Â Â Â ajax_loading_image('.ajax_loading_image'); >> >> Â Â Â Â $.ajax({ >> Â Â Â Â Â Â Â Â type: "POST", >> Â Â Â Â Â Â Â Â url: '/bookings/getLocations', >> Â Â Â Â Â Â Â Â data: "ajax=true&id="+selected, >> Â Â Â Â Â Â Â Â success: function(msg){ >> Â Â Â Â Â Â Â Â Â Â Â Â $(self).parent('div').html(msg); >> Â Â Â Â Â Â Â Â Â Â Â Â ajax_remove_loading_image('.ajax_loading_image'); >> Â Â Â Â Â Â Â Â } >> Â Â Â Â }); >> >> }); >> >> However, I recommend that you simply replace the options rather than >> the entire select element. >> >> On Sat, May 30, 2009 at 9:06 AM, DigitalDude >> >> <e.blumsten...@xxxxxxxxxxxxxx> wrote: >> >> > Hi, >> >> > I'm trying to deal with jQuery in CakePHP and basically I want to do >> > the following: >> >> > I have 5 select-boxes in which the user should chose some values, and >> > when a value changes the other selects should be updated with the >> > corresponding data. >> > I figured out how to update selects, that's not a big problem and it >> > works fine. But when I chose a value from a select box that has been >> > populated with jQuery, the change(function()) in my jQuery script does >> > not register the changing of the value, even though the div-id's are >> > set correct. >> > The part of my js-script where the second selectbox should be checked >> > for changed calues is not triggered, I tried many combinations of the >> > element-id but it won't start any function in that part. >> >> > Here's what I'm dealing with: >> > ---------------------------------------------------------------- >> > Main-View: >> > ---------------------------------------------------------------- >> > <?php echo $form->create('Booking',array('class'=>'ajax_page'));?> >> > Â Â Â Â<fieldset> >> > Â Â Â Â Â Â Â Â<legend>Ajax Test 1.2</legend> >> > Â Â Â Â Â Â Â Â<div class="ajax_loading_image"></div> >> > Â Â Â Â Â Â Â Â<?php >> > Â Â Â Â Â Â Â Âecho $form->input('country_id',array( >> > Â Â Â Â Â Â Â Â Â Â Â Â'label'=>'Country', >> > Â Â Â Â Â Â'empty' => 'Choose country' >> > Â Â Â Â Â Â Â Â)); >> > Â Â Â Âecho $form->input('location_id',array( >> > Â Â Â Â Â Â Â Â Â Â Â Â'label'=>'Location', >> > Â Â Â Â Â Â Â Â Â Â Â Â'type' => 'select', >> > Â Â Â Â Â Â'empty' => 'Choose location', >> > Â Â Â Â Â Â'div'=>'input select ajax_location_id' >> > Â Â Â Â)); >> > Â Â Â Â Â Â Â Âecho $form->input('shop_id',array( >> > Â Â Â Â Â Â Â Â Â Â Â Â'label'=>'Shop', >> > Â Â Â Â Â Â Â Â Â Â Â Â'type' => 'select', >> > Â Â Â Â Â Â'empty' => 'Choose shop', >> > Â Â Â Â Â Â Â Â Â Â Â Â'div'=>'input select ajax_shop_id' >> > Â Â Â Â Â Â Â Â)); >> > Â Â Â Â?> >> > <?php echo $form->end();?> >> >> > ---------------------------------------------------------------- >> > The controller- part(s): >> > ---------------------------------------------------------------- >> > Â Âfunction getLocations() { >> > Â Â Â Â$country_id = $this->params['form']['id']; >> > Â Â Â Â$locations = array(); >> > Â Â Â Â$this->layout = null; >> >> > Â Â Â Âif($country_id > 0) { >> > Â Â Â Â Â Â$locations = $this->Booking->Shop->Location->find('list', >> > array( >> > Â Â Â Â Â Â Â Â'contain' => array('Country'), >> > Â Â Â Â Â Â Â Â'conditions' => array( >> > Â Â Â Â Â Â Â Â Â Â'Location.country_id' => $country_id >> > Â Â Â Â Â Â))); >> > Â Â Â Â} >> > Â Â Â Â$this->set(compact('locations')); >> > Â Â} >> >> > Â Âfunction getActiveShops() { >> > Â Â Â Â$location_id = $this->params['form']['id']; >> > Â Â Â Â$shops = array(); >> > Â Â Â Â$this->layout = null; >> >> > Â Â Â Âif($location_id > 0) { >> > Â Â Â Â Â Â$shops = $this->Booking->Shop->find('list', array( >> > Â Â Â Â Â Â Â Â'contain' => array('Location'), >> > Â Â Â Â Â Â Â Â'conditions' => array( >> > Â Â Â Â Â Â Â Â Â Â'Shop.location_id' => $location_id >> > Â Â Â Â Â Â))); >> > Â Â Â Â} >> > Â Â Â Â$this->set(compact('shops')); >> > Â Â} >> > ---------------------------------------------------------------- >> > The jQuery-script: >> > ---------------------------------------------------------------- >> > $(document).ready(function() { >> > $('.ajax_page #BookingCountryId').change(function(){ >> > Â Â Â Âalert("Test!"); >> > Â Â// selected value >> > Â Â Â Âvar selected = $(this).val(); >> >> > Â Â Â Â// set loading image >> > Â Â Â Âajax_loading_image('.ajax_loading_image'); >> > Â Â Â Â// ajax >> > Â Â Â Â$.ajax({ >> > Â Â Â Â Â Â Â Âtype: "POST", >> > Â Â Â Â Â Â Â Âurl: '/bookings/getLocations', >> > Â Â Â Â Â Â Â Âdata: "ajax=true&id="+selected, >> > Â Â Â Â Â Â Â Âsuccess: function(msg){ >> > Â Â Â Â Â Â Â Â Â Â Â Â//console.log(msg); >> > Â Â Â Â Â Â Â Â Â Â Â Â$('.ajax_location_id').html(msg); >> > Â Â Â Â Â Â Â Â Â Â Â Â// remove loading image >> > Â Â Â Â Â Â Â Â Â Â Â Âajax_remove_loading_image('.ajax_loading_image'); >> > Â Â Â Â Â Â Â Â} >> > Â Â Â Â}); >> > }); >> > $('.ajax_page #BookingLocationId').change(function(){ >> > Â Â Â Âalert("Test!"); >> > Â Â// selected value >> > Â Â Â Âvar selected = $(this).val(); >> >> > Â Â Â Â// set loading image >> > Â Â Â Âajax_loading_image('.ajax_loading_image'); >> > Â Â Â Â// ajax >> > Â Â Â Â$.ajax({ >> > Â Â Â Â Â Â Â Âtype: "POST", >> > Â Â Â Â Â Â Â Âurl: '/bookings/getActiveShops', >> > Â Â Â Â Â Â Â Âdata: "ajax=true&id="+selected, >> > Â Â Â Â Â Â Â Âsuccess: function(msg){ >> > Â Â Â Â Â Â Â Â Â Â Â Â//console.log(msg); >> > Â Â Â Â Â Â Â Â Â Â Â Â$('.ajax_shop_id').html(msg); >> > Â Â Â Â Â Â Â Â Â Â Â Â// remove loading image >> > Â Â Â Â Â Â Â Â Â Â Â Âajax_remove_loading_image('.ajax_loading_image'); >> > Â Â Â Â Â Â Â Â} >> > Â Â Â Â}); >> > }); >> > }); >> > ---------------------------------------------------------------- >> >> > The views of the controller action which should replace the "old" >> > select-elements: >> > ---------------------------------------------------------------- >> > (*** function getLocations() ***) >> > ---------------------------------------------------------------- >> > <?php >> > if(!empty($locations)) { >> > Â Â Â Âecho $form->input('Booking.location_id',array( >> > Â Â Â Â Â Â Â Â Â Â Â Â'label'=>'Location', >> > Â Â Â Â Â Â Â Â Â Â Â Â'type' => 'select', >> > Â Â Â Â Â Â'options' => $locations, >> > Â Â Â Â Â Â'empty' => 'Choose location', >> > Â Â Â Â Â Â'div' => false, >> > Â Â Â Â Â Â'name' => 'data[Booking][location_id]' >> > Â Â Â Â)); >> > } >> > ?> >> > ---------------------------------------------------------------- >> > (*** function getLocations() ***) >> > ---------------------------------------------------------------- >> > <?php >> > if(!empty($shops)) { >> > Â Â Â Âecho $form->input('shop_id',array( >> > Â Â Â Â Â Â Â Â Â Â Â Â'label'=>'Shop', >> > Â Â Â Â Â Â Â Â Â Â Â Â'type' => 'select', >> > Â Â Â Â Â Â'options' => $shops, >> > Â Â Â Â Â Â'empty' => 'Choose shop', >> > Â Â Â Â Â Â'div' => false, >> > Â Â Â Â Â Â'name' => 'data[Booking][shop_id]' >> > Â Â Â Â)); >> > } >> > ?> >> >> > The first part where I chose a country and populate the second select- >> > box with the corresponding locations works fine and I get all the >> > right results. But when I select a location it does NOT trigger the >> > second function of the jQuery script and that gives me a headache! >> >> > What is the magic mistake in my code or my thinking? Please help me, >> > I'm stuck on this for days now and I can't figure out why this >> > aaproach does not work correct :( > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---

Previous Message by Thread: click to view message preview

List leafs in Tree Behavior

Hello,I have a system with a Model behaving as Tree, the question is.I need to get a list of rows with out children meaning records that are leafs in the tree.Is there a way to accomplish that?Of course It is the "brute force method", but since the tree might be very large, I rather have a most efficient way. Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---

Next Message by Thread: click to view message preview

I need help to build a ACL with habtm

For my application I need a ACL with habtm. In my book "Webentwicklung mit CakePHP" there´s only an example with a hasMany relation. I can't find anything I the web belonging to ACL and habtm (with the ACL of cakePHP and no custom solutions). For testing purposes I only have a simple aco tree: ROOT Fileuploads index Building the aco tree: cake acl create aco / ROOT cake acl create aco ROOT Fileuploads cake acl create aco Fileuploads index And a simple aro tree: [1] Gruppen Building the aro tree: cake acl create aro / Gruppen So I have 3 tabels: users usergroups usergroups_users Can anyone help? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@xxxxxxxxxxxxxxxx To unsubscribe from this group, send email to cake-php+unsubscribe@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by