Re: Forms security: Not displaying input means it is protected? --zivi-muh
Thanks, guys! On Fri, Nov 26, 2010 at 4:44 PM, euromark wrote: > some additional infos: > http://www.dereuromark.de/2010/10/05/cakephp-security/ > > On 26 Nov., 14:32, odd wrote: >> That's how it is. Personally i'm additionally using the fieldList >> feature (which unfortunately doesn't work well with multiple models >> and saveAll) as a last line of defense in case something goes wrong >> and a modified request slips through. >> >> Regards >> >> Joshua Muheim schrieb: >> >> >> >> >> >> >> >> > Thanks for the hint to the $whitelist, Stephen. But this seems not >> > necessary to me anymore when using the Security component (which I do >> > and I forgot to mention in my first post). Look at this >> > (http://book.cakephp.org/view/175/Security-Component): >> >> > "When using the Security Component you must use the FormHelper to >> > create your forms. The Security Component looks for certain indicators >> > that are created and managed by the FormHelper (especially those >> > created in create() and end()). Dynamically altering the fields that >> > are submitted in a POST request (e.g. disabling, deleting or creating >> > new fields via JavaScript) is likely to trigger a black-holing of the >> > request. See the $validatePost or $disabledFields configuration >> > parameters." >> >> > So if you're using Security component, the end user can't mess with >> > the POST data anymore. :-) >> >> > Any other comment about this, anyone? >> >> > On Fri, Nov 26, 2010 at 12:08 PM, Stephen >> > wrote: >> > > Hi There >> >> > > You should use a whitelist to specify the fields to save, any other >> > > fields >> > > will not be saved. >> >> > > Even if you don't display the field on the page, a user can still create >> > > the >> > > post variable from within their browser and use it to change data they >> > > shouldn't really be allowed to. >> >> > > Hope this helps >> >> > > Stephen >> >> > > On 26 November 2010 10:38, psybear83 wrote: >> >> > >> Hey everybody >> >> > >> In my application, users can edit their email, phone number etc., but >> > >> they are *not* allowed to edit their username - only admins are >> > >> allowed to do that. >> >> > >> So I'm wondering: is it safe to simply not display the username field >> > >> to the user? Afaik CakePHP makes sure that the form hasn't been >> > >> manually edited (e.g. adding a username input field), right? So I >> > >> don't have to double-check on the application's side, e.g. by >> > >> unsetting the $data[User][username] field, as long as I'm only >> > >> displaying form fields using CakePHP's form helper (and not >> > >> "deactivating" them by just hiding them using CSS or so), right? >> >> > >> If so - yeah, sweet! Thanks, CakePHP! :-) >> >> > >> Waiting for your confirmation about this fact, guys... Thanks! >> >> > >> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others >> > >> with their CakePHP related questions. >> >> > >> 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+unsubscr...@googlegroups.com For more options, visit this group >> > >> athttp://groups.google.com/group/cake-php?hl=en >> >> > > -- >> > > Kind Regards >> > > Stephen @ NinjaCoderMonkey >> >> > > www.ninjacodermonkey.co.uk >> >> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others >> > > with their CakePHP related questions. >> >> > > 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+unsubscr...@googlegroups.com For more options, visit this group >> > > at >> > >http://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms security: Not displaying input means it is protected? --zivi-muh
some additional infos: http://www.dereuromark.de/2010/10/05/cakephp-security/ On 26 Nov., 14:32, odd wrote: > That's how it is. Personally i'm additionally using the fieldList > feature (which unfortunately doesn't work well with multiple models > and saveAll) as a last line of defense in case something goes wrong > and a modified request slips through. > > Regards > > Joshua Muheim schrieb: > > > > > > > > > Thanks for the hint to the $whitelist, Stephen. But this seems not > > necessary to me anymore when using the Security component (which I do > > and I forgot to mention in my first post). Look at this > > (http://book.cakephp.org/view/175/Security-Component): > > > "When using the Security Component you must use the FormHelper to > > create your forms. The Security Component looks for certain indicators > > that are created and managed by the FormHelper (especially those > > created in create() and end()). Dynamically altering the fields that > > are submitted in a POST request (e.g. disabling, deleting or creating > > new fields via JavaScript) is likely to trigger a black-holing of the > > request. See the $validatePost or $disabledFields configuration > > parameters." > > > So if you're using Security component, the end user can't mess with > > the POST data anymore. :-) > > > Any other comment about this, anyone? > > > On Fri, Nov 26, 2010 at 12:08 PM, Stephen > > wrote: > > > Hi There > > > > You should use a whitelist to specify the fields to save, any other fields > > > will not be saved. > > > > Even if you don't display the field on the page, a user can still create > > > the > > > post variable from within their browser and use it to change data they > > > shouldn't really be allowed to. > > > > Hope this helps > > > > Stephen > > > > On 26 November 2010 10:38, psybear83 wrote: > > > >> Hey everybody > > > >> In my application, users can edit their email, phone number etc., but > > >> they are *not* allowed to edit their username - only admins are > > >> allowed to do that. > > > >> So I'm wondering: is it safe to simply not display the username field > > >> to the user? Afaik CakePHP makes sure that the form hasn't been > > >> manually edited (e.g. adding a username input field), right? So I > > >> don't have to double-check on the application's side, e.g. by > > >> unsetting the $data[User][username] field, as long as I'm only > > >> displaying form fields using CakePHP's form helper (and not > > >> "deactivating" them by just hiding them using CSS or so), right? > > > >> If so - yeah, sweet! Thanks, CakePHP! :-) > > > >> Waiting for your confirmation about this fact, guys... Thanks! > > > >> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > >> with their CakePHP related questions. > > > >> 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+unsubscr...@googlegroups.com For more options, visit this group > > >> athttp://groups.google.com/group/cake-php?hl=en > > > > -- > > > Kind Regards > > > Stephen @ NinjaCoderMonkey > > > > www.ninjacodermonkey.co.uk > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > > with their CakePHP related questions. > > > > 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+unsubscr...@googlegroups.com For more options, visit this group > > > at > > >http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms security: Not displaying input means it is protected? --zivi-muh
That's how it is. Personally i'm additionally using the fieldList feature (which unfortunately doesn't work well with multiple models and saveAll) as a last line of defense in case something goes wrong and a modified request slips through. Regards Joshua Muheim schrieb: > Thanks for the hint to the $whitelist, Stephen. But this seems not > necessary to me anymore when using the Security component (which I do > and I forgot to mention in my first post). Look at this > (http://book.cakephp.org/view/175/Security-Component): > > "When using the Security Component you must use the FormHelper to > create your forms. The Security Component looks for certain indicators > that are created and managed by the FormHelper (especially those > created in create() and end()). Dynamically altering the fields that > are submitted in a POST request (e.g. disabling, deleting or creating > new fields via JavaScript) is likely to trigger a black-holing of the > request. See the $validatePost or $disabledFields configuration > parameters." > > So if you're using Security component, the end user can't mess with > the POST data anymore. :-) > > Any other comment about this, anyone? > > On Fri, Nov 26, 2010 at 12:08 PM, Stephen > wrote: > > Hi There > > > > You should use a whitelist to specify the fields to save, any other fields > > will not be saved. > > > > Even if you don't display the field on the page, a user can still create the > > post variable from within their browser and use it to change data they > > shouldn't really be allowed to. > > > > Hope this helps > > > > Stephen > > > > On 26 November 2010 10:38, psybear83 wrote: > >> > >> Hey everybody > >> > >> In my application, users can edit their email, phone number etc., but > >> they are *not* allowed to edit their username - only admins are > >> allowed to do that. > >> > >> So I'm wondering: is it safe to simply not display the username field > >> to the user? Afaik CakePHP makes sure that the form hasn't been > >> manually edited (e.g. adding a username input field), right? So I > >> don't have to double-check on the application's side, e.g. by > >> unsetting the $data[User][username] field, as long as I'm only > >> displaying form fields using CakePHP's form helper (and not > >> "deactivating" them by just hiding them using CSS or so), right? > >> > >> If so - yeah, sweet! Thanks, CakePHP! :-) > >> > >> Waiting for your confirmation about this fact, guys... Thanks! > >> > >> Check out the new CakePHP Questions site http://cakeqs.org and help others > >> with their CakePHP related questions. > >> > >> 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+unsubscr...@googlegroups.com For more options, visit this group > >> at http://groups.google.com/group/cake-php?hl=en > > > > > > > > -- > > Kind Regards > > Stephen @ NinjaCoderMonkey > > > > www.ninjacodermonkey.co.uk > > > > > > Check out the new CakePHP Questions site http://cakeqs.org and help others > > with their CakePHP related questions. > > > > 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+unsubscr...@googlegroups.com For more options, visit this group at > > http://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms security: Not displaying input means it is protected? --zivi-muh
Ah that would explain it, I did scan your email over 3 times to be sure I wasn't misunderstanding! I haven't used the security component in this way yet so I am afraid I can't be of any further help I will use this component soon however, thanks for reminding me of its existence :) Kind Regards Stephen On 26 November 2010 12:09, Joshua Muheim wrote: > Thanks for the hint to the $whitelist, Stephen. But this seems not > necessary to me anymore when using the Security component (which I do > and I forgot to mention in my first post). Look at this > (http://book.cakephp.org/view/175/Security-Component): > > "When using the Security Component you must use the FormHelper to > create your forms. The Security Component looks for certain indicators > that are created and managed by the FormHelper (especially those > created in create() and end()). Dynamically altering the fields that > are submitted in a POST request (e.g. disabling, deleting or creating > new fields via JavaScript) is likely to trigger a black-holing of the > request. See the $validatePost or $disabledFields configuration > parameters." > > So if you're using Security component, the end user can't mess with > the POST data anymore. :-) > > Any other comment about this, anyone? > > On Fri, Nov 26, 2010 at 12:08 PM, Stephen > wrote: > > Hi There > > > > You should use a whitelist to specify the fields to save, any other > fields > > will not be saved. > > > > Even if you don't display the field on the page, a user can still create > the > > post variable from within their browser and use it to change data they > > shouldn't really be allowed to. > > > > Hope this helps > > > > Stephen > > > > On 26 November 2010 10:38, psybear83 wrote: > >> > >> Hey everybody > >> > >> In my application, users can edit their email, phone number etc., but > >> they are *not* allowed to edit their username - only admins are > >> allowed to do that. > >> > >> So I'm wondering: is it safe to simply not display the username field > >> to the user? Afaik CakePHP makes sure that the form hasn't been > >> manually edited (e.g. adding a username input field), right? So I > >> don't have to double-check on the application's side, e.g. by > >> unsetting the $data[User][username] field, as long as I'm only > >> displaying form fields using CakePHP's form helper (and not > >> "deactivating" them by just hiding them using CSS or so), right? > >> > >> If so - yeah, sweet! Thanks, CakePHP! :-) > >> > >> Waiting for your confirmation about this fact, guys... Thanks! > >> > >> Check out the new CakePHP Questions site http://cakeqs.org and help > others > >> with their CakePHP related questions. > >> > >> 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+unsubscr...@googlegroups.comFor > >> more options, visit this group > >> at http://groups.google.com/group/cake-php?hl=en > > > > > > > > -- > > Kind Regards > > Stephen @ NinjaCoderMonkey > > > > www.ninjacodermonkey.co.uk > > > > > > Check out the new CakePHP Questions site http://cakeqs.org and help > others > > with their CakePHP related questions. > > > > 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+unsubscr...@googlegroups.comFor > > more options, visit this group at > > http://groups.google.com/group/cake-php?hl=en > > > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms security: Not displaying input means it is protected? --zivi-muh
Thanks for the hint to the $whitelist, Stephen. But this seems not necessary to me anymore when using the Security component (which I do and I forgot to mention in my first post). Look at this (http://book.cakephp.org/view/175/Security-Component): "When using the Security Component you must use the FormHelper to create your forms. The Security Component looks for certain indicators that are created and managed by the FormHelper (especially those created in create() and end()). Dynamically altering the fields that are submitted in a POST request (e.g. disabling, deleting or creating new fields via JavaScript) is likely to trigger a black-holing of the request. See the $validatePost or $disabledFields configuration parameters." So if you're using Security component, the end user can't mess with the POST data anymore. :-) Any other comment about this, anyone? On Fri, Nov 26, 2010 at 12:08 PM, Stephen wrote: > Hi There > > You should use a whitelist to specify the fields to save, any other fields > will not be saved. > > Even if you don't display the field on the page, a user can still create the > post variable from within their browser and use it to change data they > shouldn't really be allowed to. > > Hope this helps > > Stephen > > On 26 November 2010 10:38, psybear83 wrote: >> >> Hey everybody >> >> In my application, users can edit their email, phone number etc., but >> they are *not* allowed to edit their username - only admins are >> allowed to do that. >> >> So I'm wondering: is it safe to simply not display the username field >> to the user? Afaik CakePHP makes sure that the form hasn't been >> manually edited (e.g. adding a username input field), right? So I >> don't have to double-check on the application's side, e.g. by >> unsetting the $data[User][username] field, as long as I'm only >> displaying form fields using CakePHP's form helper (and not >> "deactivating" them by just hiding them using CSS or so), right? >> >> If so - yeah, sweet! Thanks, CakePHP! :-) >> >> Waiting for your confirmation about this fact, guys... Thanks! >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> 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+unsubscr...@googlegroups.com For more options, visit this group >> at http://groups.google.com/group/cake-php?hl=en > > > > -- > Kind Regards > Stephen @ NinjaCoderMonkey > > www.ninjacodermonkey.co.uk > > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms security: Not displaying input means it is protected? --zivi-muh
Hi There You should use a whitelist to specify the fields to save, any other fields will not be saved. Even if you don't display the field on the page, a user can still create the post variable from within their browser and use it to change data they shouldn't really be allowed to. Hope this helps Stephen On 26 November 2010 10:38, psybear83 wrote: > Hey everybody > > In my application, users can edit their email, phone number etc., but > they are *not* allowed to edit their username - only admins are > allowed to do that. > > So I'm wondering: is it safe to simply not display the username field > to the user? Afaik CakePHP makes sure that the form hasn't been > manually edited (e.g. adding a username input field), right? So I > don't have to double-check on the application's side, e.g. by > unsetting the $data[User][username] field, as long as I'm only > displaying form fields using CakePHP's form helper (and not > "deactivating" them by just hiding them using CSS or so), right? > > If so - yeah, sweet! Thanks, CakePHP! :-) > > Waiting for your confirmation about this fact, guys... Thanks! > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms/Model SQL Error
Please provide more information! - Specify how the User model is defined together with the validation. Question: - is your controller named Register or Registers? In your form create statement you name it Register! Enjoy, John On Jun 29, 10:50 pm, Nabeel wrote: > Hi all, > > I'm trying to create a form - I have a Users model with some simple > validation. I'm creating a form with: > > http://bin.cakephp.org/view/2134760139 > > The output from this on the page is: > > http://bin.cakephp.org/view/220211324 > > Hmm, that's not right. So I turn up debug: > > http://bin.cakephp.org/view/1647080842 > > Not so pretty but basically: > > Warning (512): SQL Error: 1064: You have an error in your SQL syntax; > check the manual that corresponds to your MySQL server version for the > right syntax to use near 'entity' at line 1 [CORE/cake/libs/model/ > datasources/dbo_source.php, line 673] > > Showing where the form starts, and then: > > Warning (2): implode() [http://php.net/function.implode]: Invalid > arguments passed [CORE/cake/libs/view/helper.php, line 643 > Warning (2): array_shift() expects parameter 1 to be array, boolean > given [CORE/cake/libs/view/helper.php, line 597] > Warning (2): array_map() [http://php.net/function.array-map]: Argument > #2 should be an array [CORE/cake/libs/view/hel > Warning (2): join() [http://php.net/function.join]: Invalid arguments > passed [CORE/cake/libs/view/helper.php, line 598] > > When I remove the public $uses = array('User'); from my controller, > there are no errors, and the fields show up properly. But then of > course, I can't do any validation or saving of the data. > > Any ideas? > Thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: forms
I don't see way it doesn't work. As Shaz suggested, double check if you have the helper enabled. On Tue, Jun 22, 2010 at 4:08 PM, Shaz wrote: > Try using $this->Form->create() instead of $form->create() in the > view. Also make sure your form helper is enabled in the model. > > On Jun 22, 9:36 am, mirfan wrote: > > This is the script > > > > $form->create("User",array('controller'=>'users','action'=>'register'));?> > > > > > > First Name * > > $form->input('User.first_name', > > array('label'=>false,'class'=>'inputbox'));?> > > Last Name * > > input('User.last_name', > > array('label'=>false,'class'=>'inputbox'));?> > > Email * > > input('User.email', > > array('label'=>false,'class'=>'inputbox'));?> > > Password * > > input('User.password', > > array('label'=>false,'div'=>false,'class'=>'inputbox'));?> > > Confirm Password > * > > > > id="password2" > > name="password2" /> > > > > > > input('User.group_id', > > array('label'=>false,'type'=>'hidden','value'=>$type));?> > > > > Keywords* > > $form->input('Profile.keywords', > > array('label'=>false,'div'=>'false','class'=>'inputbox'))?> > > > > Terms* > > input('User.terms', > > array('div'=>false,'label'=>false));?> > > I accept the terms applied by SocialBidz > > > > value="Register" > > id="submitBtn3" /> > > > > > > > > Field with * > are required > > end();?> > > > > this is the output > > > > > > > > type="hidden" value="POST" > > name="_method">id="ui-formular-error"> > > First Name * > > type="text" > > id="UserFirstName" value="" maxlength="50" class="inputbox" > > name="data[User][first_name]"> Last > Name * > span> > > type="text" > > id="UserLastName" value="" maxlength="50" class="inputbox" > > name="data[User][last_name]"> Email > * > label> > > type="text" id="UserEmail" value="" > > maxlength="100" class="inputbox" name="data[User][email]"> > > Password * > > value="" class="inputbox" > > name="data[User][password]"> Confirm > Password * > span> > > > > id="password2" > > class="inputbox"> > > > > > > value="" name="data[User] > > [group_id]"> > > Keywords* > > id="ProfileKeywords" class="inputbox" > > rows="6" cols="30" name="data[Profile][keywords]"> > div> > > Terms* > > id="UserTerms_" name="data[User] > > [terms]"> > name="data[User][terms]"> I accept the terms > applied by SocialBidz > > > > > > > > id="submitBtn3" > > value="Register"> > > > > > > > > Field with * > are required > > > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: forms
Try using $this->Form->create() instead of $form->create() in the view. Also make sure your form helper is enabled in the model. On Jun 22, 9:36 am, mirfan wrote: > This is the script > > $form->create("User",array('controller'=>'users','action'=>'register'));?> > > > First Name * > input('User.first_name', > array('label'=>false,'class'=>'inputbox'));?> > Last Name * > input('User.last_name', > array('label'=>false,'class'=>'inputbox'));?> > Email * > input('User.email', > array('label'=>false,'class'=>'inputbox'));?> > Password * > input('User.password', > array('label'=>false,'div'=>false,'class'=>'inputbox'));?> > Confirm Password * > > id="password2" > name="password2" /> > > > input('User.group_id', > array('label'=>false,'type'=>'hidden','value'=>$type));?> > > Keywords* > input('Profile.keywords', > array('label'=>false,'div'=>'false','class'=>'inputbox'))?> > > Terms* > input('User.terms', > array('div'=>false,'label'=>false));?> > I accept the terms applied by SocialBidz > > value="Register" > id="submitBtn3" /> > > > > Field with * are > required > end();?> > > this is the output > > > > value="POST" > name="_method"> id="ui-formular-error"> > First Name * > type="text" > id="UserFirstName" value="" maxlength="50" class="inputbox" > name="data[User][first_name]"> Last Name > * span> > type="text" > id="UserLastName" value="" maxlength="50" class="inputbox" > name="data[User][last_name]"> Email > * label> > id="UserEmail" value="" > maxlength="100" class="inputbox" name="data[User][email]"> > Password * > value="" class="inputbox" > name="data[User][password]"> Confirm > Password * span> > > id="password2" > class="inputbox"> > > > value="" name="data[User] > [group_id]"> > Keywords* > id="ProfileKeywords" class="inputbox" > rows="6" cols="30" name="data[Profile][keywords]"> div> > Terms* > id="UserTerms_" name="data[User] > [terms]"> name="data[User][terms]"> I accept the terms applied > by SocialBidz > > > > id="submitBtn3" > value="Register"> > > > > Field with * are > required > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: forms
This is the script create("User",array('controller'=>'users','action'=>'register'));?> First Name * input('User.first_name', array('label'=>false,'class'=>'inputbox'));?> Last Name * input('User.last_name', array('label'=>false,'class'=>'inputbox'));?> Email * input('User.email', array('label'=>false,'class'=>'inputbox'));?> Password * input('User.password', array('label'=>false,'div'=>false,'class'=>'inputbox'));?> Confirm Password * input('User.group_id', array('label'=>false,'type'=>'hidden','value'=>$type));?> Keywords* input('Profile.keywords', array('label'=>false,'div'=>'false','class'=>'inputbox'))?> Terms* input('User.terms', array('div'=>false,'label'=>false));?> I accept the terms applied by SocialBidz Field with * are required end();?> this is the output First Name * Last Name * Email * Password * Confirm Password * Keywords* Terms* I accept the terms applied by SocialBidz Field with * are required Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: forms
Can you post the page source? On Tue, Jun 22, 2010 at 11:00 AM, mirfan wrote: > It create all fields correctly but form tag is not available, no error > is displayed, however this fieldset is availabe > > name="_method"> > > i am not able to understand what is happening. > > On Jun 22, 12:49 pm, Jeremy Burns | Class Outfit > wrote: > > Help us to help you. If forms are not being created, what IS happening > instead? Are you getting errors? Do you have debug set to 2 so that you can > see what's going on? > > > > Jeremy Burns > > Class Outfit > > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > > > On 22 Jun 2010, at 08:46, mirfan wrote: > > > > > Hi, > > > Its very urgent and rediculus that my cakephp application is not > > > creating form, any where in my application i am generating form they > > > are are not created either through echo $form->create() or through > > > html form tag > > > > > please help me. > > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help > others with their CakePHP related questions. > > > > > 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+unsubscr...@googlegroups.comFor > > > more options, visit this group athttp:// > groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: forms
It create all fields correctly but form tag is not available, no error is displayed, however this fieldset is availabe i am not able to understand what is happening. On Jun 22, 12:49 pm, Jeremy Burns | Class Outfit wrote: > Help us to help you. If forms are not being created, what IS happening > instead? Are you getting errors? Do you have debug set to 2 so that you can > see what's going on? > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 22 Jun 2010, at 08:46, mirfan wrote: > > > Hi, > > Its very urgent and rediculus that my cakephp application is not > > creating form, any where in my application i am generating form they > > are are not created either through echo $form->create() or through > > html form tag > > > please help me. > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > 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+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: forms
If doesn't work, then most probably it's not a cake issue. Set debug to 2 and check what errors do you get. On Tue, Jun 22, 2010 at 10:46 AM, mirfan wrote: > Hi, > Its very urgent and rediculus that my cakephp application is not > creating form, any where in my application i am generating form they > are are not created either through echo $form->create() or through > html form tag > > please help me. > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: forms
Help us to help you. If forms are not being created, what IS happening instead? Are you getting errors? Do you have debug set to 2 so that you can see what's going on? Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 22 Jun 2010, at 08:46, mirfan wrote: > Hi, > Its very urgent and rediculus that my cakephp application is not > creating form, any where in my application i am generating form they > are are not created either through echo $form->create() or through > html form tag > > please help me. > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms and Descriptions
Just for completeness, there are five options that are potential descriptors: - label - before - between (comes between the label and input) - separator - after http://book.cakephp.org/view/1393/options-before-options-between-options-separator-a Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 10 Jun 2010, at 23:28, Chris Hanson wrote: > ye know about label just wasnt sure on after lol thanks :D > > On 10 June 2010 17:15, Flavia Missi wrote: >> Hi! >> >> You can define a label for the input too, look like this: >> >> $form->input('input_name', array('label'=>'label name', >> 'after'=>'description for input')); >> >> Sorry if I wrote something wrong, I'm brazilian! ^^ >> >> Hope it helps... >> >> 2010/6/10 phpcoder2...@googlemail.com >>> >>> cheers Jeremy! you seem to reply to everyone's issues :D lol thanks! >>> >>> On Jun 10, 4:56 pm, Jeremy Burns | Class Outfit >>> wrote: User the 'after' option and then apply css: echo $this->Form->input( 'field_name', array( 'after' => 'Your description...' ) ); Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote: > Hey guys building a form and not sure how to go about adding > descriptions to each input, from what ive seen there is no description > option in the $form->input(); does anyone know of a simple way to > achieve this? > thanks > Check out the new CakePHP Questions sitehttp://cakeqs.organd help > others with their CakePHP related questions. > 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+unsubscr...@googlegroups.com For more options, visit this > group athttp://groups.google.com/group/cake-php?hl=en >>> >>> Check out the new CakePHP Questions site http://cakeqs.org and help others >>> with their CakePHP related questions. >>> >>> 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+unsubscr...@googlegroups.com For more options, visit this group >>> at http://groups.google.com/group/cake-php?hl=en >> >> >> >> -- >> Flàvia Missi >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> 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+unsubscr...@googlegroups.com For more options, visit this group at >> http://groups.google.com/group/cake-php?hl=en >> > > > > -- > Kind Regards Chris > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms and Descriptions
Hi! You can define a label for the input too, look like this: $form->input('input_name', array('label'=>'label name', 'after'=>'description for input')); Sorry if I wrote something wrong, I'm brazilian! ^^ Hope it helps... 2010/6/10 phpcoder2...@googlemail.com > cheers Jeremy! you seem to reply to everyone's issues :D lol thanks! > > On Jun 10, 4:56 pm, Jeremy Burns | Class Outfit > wrote: > > User the 'after' option and then apply css: > > > > echo $this->Form->input( > > 'field_name', > > array( > > 'after' => 'Your description...' > > ) > > ); > > > > Jeremy Burns > > Class Outfit > > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > > > On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote: > > > > > > > > > Hey guys building a form and not sure how to go about adding > > > descriptions to each input, from what ive seen there is no description > > > option in the $form->input(); does anyone know of a simple way to > > > achieve this? > > > > > thanks > > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help > others with their CakePHP related questions. > > > > > 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+unsubscr...@googlegroups.comFor > > > more options, visit this group athttp:// > groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Flàvia Missi Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms and Descriptions
ye know about label just wasnt sure on after lol thanks :D On 10 June 2010 17:15, Flavia Missi wrote: > Hi! > > You can define a label for the input too, look like this: > > $form->input('input_name', array('label'=>'label name', > 'after'=>'description for input')); > > Sorry if I wrote something wrong, I'm brazilian! ^^ > > Hope it helps... > > 2010/6/10 phpcoder2...@googlemail.com >> >> cheers Jeremy! you seem to reply to everyone's issues :D lol thanks! >> >> On Jun 10, 4:56 pm, Jeremy Burns | Class Outfit >> wrote: >> > User the 'after' option and then apply css: >> > >> > echo $this->Form->input( >> > 'field_name', >> > array( >> > 'after' => 'Your description...' >> > ) >> > ); >> > >> > Jeremy Burns >> > Class Outfit >> > >> > jeremybu...@classoutfit.comhttp://www.classoutfit.com >> > >> > On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote: >> > >> > >> > >> > > Hey guys building a form and not sure how to go about adding >> > > descriptions to each input, from what ive seen there is no description >> > > option in the $form->input(); does anyone know of a simple way to >> > > achieve this? >> > >> > > thanks >> > >> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help >> > > others with their CakePHP related questions. >> > >> > > 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+unsubscr...@googlegroups.com For more options, visit this >> > > group athttp://groups.google.com/group/cake-php?hl=en >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> 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+unsubscr...@googlegroups.com For more options, visit this group >> at http://groups.google.com/group/cake-php?hl=en > > > > -- > Flàvia Missi > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Kind Regards Chris Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms and Descriptions
ye i thought about that, but thought there may be a cake wayoh well lol thanks for the help :D On Jun 10, 5:14 pm, Jeremy Burns | Class Outfit wrote: > Wild stab without thinking, researching or testing... > > I think you could do: > > 'after' => 'My description...' > > ...and then style span.description. > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 10 Jun 2010, at 17:00, phpcoder2...@googlemail.com wrote: > > > > > is there a way to wrap class around, like after_class? thanks > > > On Jun 10, 4:56 pm, Jeremy Burns | Class Outfit > > wrote: > >> User the 'after' option and then apply css: > > >> echo $this->Form->input( > >> 'field_name', > >> array( > >> 'after' => 'Your description...' > >> ) > >> ); > > >> Jeremy Burns > >> Class Outfit > > >> jeremybu...@classoutfit.comhttp://www.classoutfit.com > > >> On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote: > > >>> Hey guys building a form and not sure how to go about adding > >>> descriptions to each input, from what ive seen there is no description > >>> option in the $form->input(); does anyone know of a simple way to > >>> achieve this? > > >>> thanks > > >>> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others > >>> with their CakePHP related questions. > > >>> 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+unsubscr...@googlegroups.com For more options, visit this group > >>> athttp://groups.google.com/group/cake-php?hl=en > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > 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+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms and Descriptions
Wild stab without thinking, researching or testing... I think you could do: 'after' => 'My description...' ...and then style span.description. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 10 Jun 2010, at 17:00, phpcoder2...@googlemail.com wrote: > is there a way to wrap class around, like after_class? thanks > > On Jun 10, 4:56 pm, Jeremy Burns | Class Outfit > wrote: >> User the 'after' option and then apply css: >> >> echo $this->Form->input( >> 'field_name', >> array( >> 'after' => 'Your description...' >> ) >> ); >> >> Jeremy Burns >> Class Outfit >> >> jeremybu...@classoutfit.comhttp://www.classoutfit.com >> >> On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote: >> >> >> >>> Hey guys building a form and not sure how to go about adding >>> descriptions to each input, from what ive seen there is no description >>> option in the $form->input(); does anyone know of a simple way to >>> achieve this? >> >>> thanks >> >>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others >>> with their CakePHP related questions. >> >>> 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+unsubscr...@googlegroups.com For more options, visit this group >>> athttp://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms and Descriptions
is there a way to wrap class around, like after_class? thanks On Jun 10, 4:56 pm, Jeremy Burns | Class Outfit wrote: > User the 'after' option and then apply css: > > echo $this->Form->input( > 'field_name', > array( > 'after' => 'Your description...' > ) > ); > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote: > > > > > Hey guys building a form and not sure how to go about adding > > descriptions to each input, from what ive seen there is no description > > option in the $form->input(); does anyone know of a simple way to > > achieve this? > > > thanks > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > 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+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms and Descriptions
cheers Jeremy! you seem to reply to everyone's issues :D lol thanks! On Jun 10, 4:56 pm, Jeremy Burns | Class Outfit wrote: > User the 'after' option and then apply css: > > echo $this->Form->input( > 'field_name', > array( > 'after' => 'Your description...' > ) > ); > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote: > > > > > Hey guys building a form and not sure how to go about adding > > descriptions to each input, from what ive seen there is no description > > option in the $form->input(); does anyone know of a simple way to > > achieve this? > > > thanks > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > 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+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Forms and Descriptions
User the 'after' option and then apply css: echo $this->Form->input( 'field_name', array( 'after' => 'Your description...' ) ); Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote: > Hey guys building a form and not sure how to go about adding > descriptions to each input, from what ive seen there is no description > option in the $form->input(); does anyone know of a simple way to > achieve this? > > thanks > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > 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+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
RE: Forms: HABTM with additional fields in join table
I had the same problem with very little help but my situation was different and had multiple models using the join table, but after a lot of trial an error I managed to get it. I scrapped the HABTM joins and went with the hasMany aproach. Uses the same number of models, use you standard modela_modelb join table add all the fields you want. I needed a checkbox but ended up switching to a select as it was more ideal for my setup but the problem that I had was population of the fields because the data array came back as [0][1][2] and it never lined up with my field keys so I had to edit the array info to return the array like [6]=> something [9]=> you get the idea And my fields were modelA.6.name modelA.9.name Degug your data to see what comes back and from there figure out how to get what you need from what you have. Dave -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Ernesto Sent: January-13-10 12:31 PM To: CakePHP Subject: Forms: HABTM with additional fields in join table Hello. Person HABTM Training i'm coding the Person::add and Person::edit views there's plenty of examples/tutorials wich explains how to code an HABTM form... but unfortunately none of them explains how to add additional information in the join table (in my case "who_added_this_relationship", "expiration_date" and "notes"). almost forgot... training_id should be a select box. can someone help me plz? No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: 01/13/10 04:05:00 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: forms in a element
Your form has no name. On Aug 5, 3:15 pm, cakephp_rocks wrote: > hey i created a form in a element and add the to my home page for some > reason when i submit it it say Invalid form submission and redirect > me to this '/users/register/' i give to the form any idea > here is what i did > > echo $form->create(null, array('url' => '/users/register/' . $this- > > >params['url']['url'])); > > $out = $form->input('username', array('label' => __('Email *', > true))); > $out .= $form->input('email',array('label' => __('confirm Email*', > true))); > $firstName = $form->input('first_name', array('label' => __('First > Name *', true)), array('fieldset' => false)); > echo sprintf($html->tags['fieldset'], '', sprintf($html->tags > ['legend'], __('Sign Up', true)) . $out); > > echo $form->end('submit'); > ?> --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with multiple tables
Hi Travis, Please read http://book.cakephp.org/view/438/displayField Regards, Hendry On Sun, Jul 5, 2009 at 7:36 AM, Travis wrote: > Thanks, That worked. > > I have one more question, is there a way I can tell it what field to > put in the select, right now it is using the field "name" and I would > like it to use the field "common_name" since as you can figure out > common name is what we call it, as apposed to the government assigned > name. > > Travis --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with multiple tables
Thanks, That worked. I have one more question, is there a way I can tell it what field to put in the select, right now it is using the field "name" and I would like it to use the field "common_name" since as you can figure out common name is what we call it, as apposed to the government assigned name. Travis On Jul 3, 10:13 pm, "Paul" wrote: > Sorry last post sent in error > > So you have your view with some fields in it, including your forign key - > here assuming farm_id > > views/fields/add.ctp > > create('Field')?> > input('name')?> > input('another')?> > input('yet_another')?> > input('farm_id')?> > end('Submit')?> > > And in your controller action add ( as long as you have your association set > up correctly which we'll assume you do as you mention it) > > controllers/fields_controller.php > > function add(){ > ~ > $this->set('farms', $this->Field->Farm->find('list')); > > } > > This will set values to your view that the form helper will automatically > pick up and set as the values of your Field.farm_id input - which will > become a select. > > > > -Original Message- > From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf > > Of Travis > Sent: Saturday, 4 July 2009 3:34 a.m. > To: CakePHP > Subject: Forms with multiple tables > > I am new to cakePHP and am in the process of learning to use it. > > I am wondering how I can have a form element populated with elements > from a different table than the model, for example > > I am wanting to write a farm manager using cakePHP as the framework, > if I have fields that belong to farms, when you create a new field I > want to be able to select from a list of farms, and have it link > (insert farm's id as a foreign key), I have currently setup my > belongsto relationship so I can view but I cannot add. > > my original thought was to create a $options array and just loop > through the table, but I cannot do that if I do not have access to the > farms table. > > Help! > > __ Information from ESET NOD32 Antivirus, version of virus signature > database 4214 (20090703) __ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > __ Information from ESET NOD32 Antivirus, version of virus signature > database 4215 (20090704) __ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Forms with multiple tables
Sorry last post sent in error So you have your view with some fields in it, including your forign key - here assuming farm_id views/fields/add.ctp create('Field')?> input('name')?> input('another')?> input('yet_another')?> input('farm_id')?> end('Submit')?> And in your controller action add ( as long as you have your association set up correctly which we'll assume you do as you mention it) controllers/fields_controller.php function add(){ ~ $this->set('farms', $this->Field->Farm->find('list')); } This will set values to your view that the form helper will automatically pick up and set as the values of your Field.farm_id input - which will become a select. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Travis Sent: Saturday, 4 July 2009 3:34 a.m. To: CakePHP Subject: Forms with multiple tables I am new to cakePHP and am in the process of learning to use it. I am wondering how I can have a form element populated with elements from a different table than the model, for example I am wanting to write a farm manager using cakePHP as the framework, if I have fields that belong to farms, when you create a new field I want to be able to select from a list of farms, and have it link (insert farm's id as a foreign key), I have currently setup my belongsto relationship so I can view but I cannot add. my original thought was to create a $options array and just loop through the table, but I cannot do that if I do not have access to the farms table. Help! __ Information from ESET NOD32 Antivirus, version of virus signature database 4214 (20090703) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 4215 (20090704) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Forms with multiple tables
So you have your view views/fields/add.ctp create('Field')?> create('Field')?> -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Travis Sent: Saturday, 4 July 2009 3:34 a.m. To: CakePHP Subject: Forms with multiple tables I am new to cakePHP and am in the process of learning to use it. I am wondering how I can have a form element populated with elements from a different table than the model, for example I am wanting to write a farm manager using cakePHP as the framework, if I have fields that belong to farms, when you create a new field I want to be able to select from a list of farms, and have it link (insert farm's id as a foreign key), I have currently setup my belongsto relationship so I can view but I cannot add. my original thought was to create a $options array and just loop through the table, but I cannot do that if I do not have access to the farms table. Help! __ Information from ESET NOD32 Antivirus, version of virus signature database 4214 (20090703) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 4215 (20090704) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms and saveAll
Hi Dave, It is written in the CookBook at: http://book.cakephp.org/view/75/Saving-Your-Data Look at saveAll as well as the subsection at: http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo All is explained there :) Enjoy, John On Jun 25, 4:10 pm, "Dave Maharaj :: WidePixels.com" wrote: > Just a question about figuring out how to aproach this situation. If you > think of a resume you may have more than 1 education / work history...so on > > User hasMany "educations" so in the case of a resume how could you create 1 > form that would load all of the users educations they have created? So if > user wanted to edit thier 'educations" it would load the form with the 3 > educations they have created. Is there an easy way to set this up? Rather > thn edit/1, edit/2, edit/3 they could edit all on 1 page with only 1 submit > > Suggestion? > > Thanks, > > Dave --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with math computations and multiple buttons
Actually, I'm using version 1.2.3.8166. Hope you guys could help me. Mark (germany) wrote: > > > i guess you use cake 1.1 > > as in 1.2 cake seems not to use $this->params['form'] > (always an empty array) > > mark > > > On 29 Mai, 03:43, espontaneo wrote: >> Thanks for answering my questions. The number helper is only for the view >> right? Can I use it on my component/controller? I have search through the >> internet and people don't recommend it. >> >> brian-263 wrote: >> >> > OK, I understand. Why don't you use the currency method? >> >> >http://api.cakephp.org/class/number-helper#method-NumberHelpercurrency >> >> > You might want to override the defaults with the $options array if you >> > don't want a dollar sign, etc. >> >> > Note that the comment for format() method ("Formats a number into a >> > currency format.") is bogus. That's just been copied from currency(). >> >> -- >> View this message in >> context:http://www.nabble.com/Forms-with-math-computations-and-multiple-butto... >> Sent from the CakePHP mailing list archive at Nabble.com. > > > > -- View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23811956.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with math computations and multiple buttons
i guess you use cake 1.1 as in 1.2 cake seems not to use $this->params['form'] (always an empty array) mark On 29 Mai, 03:43, espontaneo wrote: > Thanks for answering my questions. The number helper is only for the view > right? Can I use it on my component/controller? I have search through the > internet and people don't recommend it. > > brian-263 wrote: > > > OK, I understand. Why don't you use the currency method? > > >http://api.cakephp.org/class/number-helper#method-NumberHelpercurrency > > > You might want to override the defaults with the $options array if you > > don't want a dollar sign, etc. > > > Note that the comment for format() method ("Formats a number into a > > currency format.") is bogus. That's just been copied from currency(). > > -- > View this message in > context:http://www.nabble.com/Forms-with-math-computations-and-multiple-butto... > Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with math computations and multiple buttons
Thanks for answering my questions. The number helper is only for the view right? Can I use it on my component/controller? I have search through the internet and people don't recommend it. brian-263 wrote: > > > OK, I understand. Why don't you use the currency method? > > http://api.cakephp.org/class/number-helper#method-NumberHelpercurrency > > You might want to override the defaults with the $options array if you > don't want a dollar sign, etc. > > Note that the comment for format() method ("Formats a number into a > currency format.") is bogus. That's just been copied from currency(). > > -- View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23772979.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with math computations and multiple buttons
OK, I understand. Why don't you use the currency method? http://api.cakephp.org/class/number-helper#method-NumberHelpercurrency You might want to override the defaults with the $options array if you don't want a dollar sign, etc. Note that the comment for format() method ("Formats a number into a currency format.") is bogus. That's just been copied from currency(). On Wed, May 27, 2009 at 9:30 PM, espontaneo wrote: > > > Isn't the number helper the equivalent of number_format()? How can I format > the computed values coming from my component? > > part of my controller code: > $this->data['Model']['field'] = $this->component->function($salary). '.00'; > > If you notice the . '.00' I have in my code above, I'm having problems with > formatting the computed values in a money format. For the meantime, I'm > concatenating the result with the decimal point. But I want to format it > properly. I've tried to use the number helper and I've searched through the > net about this, but I can't get enough information. > > > brian-263 wrote: >> >> >> I'm not sure what you mean. sprintf()? >> >> http://www.php.net/manual/en/function.sprintf.php >> >> > -- > View this message in context: > http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23753775.html > Sent from the CakePHP mailing list archive at Nabble.com. > > > > > --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with math computations and multiple buttons
Isn't the number helper the equivalent of number_format()? How can I format the computed values coming from my component? part of my controller code: $this->data['Model']['field'] = $this->component->function($salary). '.00'; If you notice the . '.00' I have in my code above, I'm having problems with formatting the computed values in a money format. For the meantime, I'm concatenating the result with the decimal point. But I want to format it properly. I've tried to use the number helper and I've searched through the net about this, but I can't get enough information. brian-263 wrote: > > > I'm not sure what you mean. sprintf()? > > http://www.php.net/manual/en/function.sprintf.php > > -- View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23753775.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with math computations and multiple buttons
I'm not sure what you mean. sprintf()? http://www.php.net/manual/en/function.sprintf.php On Tue, May 26, 2009 at 9:23 PM, espontaneo wrote: > > > it works, thanks! > > I have another question, how can I format the computed values coming from my > component? > > > > brian-263 wrote: >> >> >> if (isset($this->params['form']['compute'])) >> >> On Tue, May 26, 2009 at 3:31 AM, espontaneo wrote: >>> >>> >>> Hope you guys could help me. I am currently working on a form that will >>> have >>> two buttons: Compute and Add. >>> >>> What I wanted to do: click Compute button->computed values will populate >>> fields->click Add button(submit form) >>> >>> So when I click on my Compute button, the salary will be passed on a >>> component I made and will be processed to come up with computed values to >>> populate some fields before I submit the form. The compute button is >>> working >>> well but when I click on the add button, I am getting errors "Notice (8): >>> Undefined index: compute [APP\controllers\deductions_controller.php, >>> line >>> 67]" and "Warning (2): Cannot modify header information - headers already >>> sent by (output started at D:\wamp\www\cake\cake\basics.php:111) >>> [CORE\cake\libs\controller\controller.php, line 640]" >>> >>> here's my controller code for the buttons: >>> if($this->params['form']['compute'] == "Compute") >>> { >>> $this->data['Model']['field'] = >>> $this->component->function($salary). '.00'; >>> $this->data['Model']['field'] = >>> $this->component->function($salary). '.00'; >>> $this->data['Model']['field'] = >>> $this->component->function($salary). '.00'; >>> } >>> elseif($this->params['form']['add'] == "Add") >>> { >>> $this->Model->save($this->data); >>> >>> $this->Session->setFlash('Deductions has been added to >>> employee', 'success'); >>> $this->redirect(array('action' => 'list_deduction')); >>> } >>> >>> Also, if you notice the . '.00' I have in my Compute button code above, >>> I'm >>> having problems with formatting the computed values in a money format so >>> for >>> now, I'm concatenating the result with the decimal point. But I want to >>> do >>> it properly. I've tried to use the number helper and I've searched >>> through >>> the net about this, but I can't get enough information. >>> -- >>> View this message in context: >>> http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23718059.html >>> Sent from the CakePHP mailing list archive at Nabble.com. >>> >>> >>> > >>> >> >> > >> >> > > -- > View this message in context: > http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23734427.html > Sent from the CakePHP mailing list archive at Nabble.com. > > > > > --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with math computations and multiple buttons
it works, thanks! I have another question, how can I format the computed values coming from my component? brian-263 wrote: > > > if (isset($this->params['form']['compute'])) > > On Tue, May 26, 2009 at 3:31 AM, espontaneo wrote: >> >> >> Hope you guys could help me. I am currently working on a form that will >> have >> two buttons: Compute and Add. >> >> What I wanted to do: click Compute button->computed values will populate >> fields->click Add button(submit form) >> >> So when I click on my Compute button, the salary will be passed on a >> component I made and will be processed to come up with computed values to >> populate some fields before I submit the form. The compute button is >> working >> well but when I click on the add button, I am getting errors "Notice (8): >> Undefined index: compute [APP\controllers\deductions_controller.php, >> line >> 67]" and "Warning (2): Cannot modify header information - headers already >> sent by (output started at D:\wamp\www\cake\cake\basics.php:111) >> [CORE\cake\libs\controller\controller.php, line 640]" >> >> here's my controller code for the buttons: >> if($this->params['form']['compute'] == "Compute") >> { >> $this->data['Model']['field'] = >> $this->component->function($salary). '.00'; >> $this->data['Model']['field'] = >> $this->component->function($salary). '.00'; >> $this->data['Model']['field'] = >> $this->component->function($salary). '.00'; >> } >> elseif($this->params['form']['add'] == "Add") >> { >> $this->Model->save($this->data); >> >> $this->Session->setFlash('Deductions has been added to >> employee', 'success'); >> $this->redirect(array('action' => 'list_deduction')); >> } >> >> Also, if you notice the . '.00' I have in my Compute button code above, >> I'm >> having problems with formatting the computed values in a money format so >> for >> now, I'm concatenating the result with the decimal point. But I want to >> do >> it properly. I've tried to use the number helper and I've searched >> through >> the net about this, but I can't get enough information. >> -- >> View this message in context: >> http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23718059.html >> Sent from the CakePHP mailing list archive at Nabble.com. >> >> >> > >> > > > > > -- View this message in context: http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23734427.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms with math computations and multiple buttons
if (isset($this->params['form']['compute'])) On Tue, May 26, 2009 at 3:31 AM, espontaneo wrote: > > > Hope you guys could help me. I am currently working on a form that will have > two buttons: Compute and Add. > > What I wanted to do: click Compute button->computed values will populate > fields->click Add button(submit form) > > So when I click on my Compute button, the salary will be passed on a > component I made and will be processed to come up with computed values to > populate some fields before I submit the form. The compute button is working > well but when I click on the add button, I am getting errors "Notice (8): > Undefined index: compute [APP\controllers\deductions_controller.php, line > 67]" and "Warning (2): Cannot modify header information - headers already > sent by (output started at D:\wamp\www\cake\cake\basics.php:111) > [CORE\cake\libs\controller\controller.php, line 640]" > > here's my controller code for the buttons: > if($this->params['form']['compute'] == "Compute") > { > $this->data['Model']['field'] = > $this->component->function($salary). '.00'; > $this->data['Model']['field'] = > $this->component->function($salary). '.00'; > $this->data['Model']['field'] = > $this->component->function($salary). '.00'; > } > elseif($this->params['form']['add'] == "Add") > { > $this->Model->save($this->data); > > $this->Session->setFlash('Deductions has been added to > employee', 'success'); > $this->redirect(array('action' => 'list_deduction')); > } > > Also, if you notice the . '.00' I have in my Compute button code above, I'm > having problems with formatting the computed values in a money format so for > now, I'm concatenating the result with the decimal point. But I want to do > it properly. I've tried to use the number helper and I've searched through > the net about this, but I can't get enough information. > -- > View this message in context: > http://www.nabble.com/Forms-with-math-computations-and-multiple-buttons-tp23718059p23718059.html > Sent from the CakePHP mailing list archive at Nabble.com. > > > > > --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms - How to give an ID or class to my reset button
Thanks! On 4 mayo, 13:22, "Bogdan I. Bursuc" wrote: > echo $form->button('Reset', array('type' => 'reset', 'id' => > 'resetBtn')); > > On Sun, 2009-05-03 at 11:15 -0700, Bankai wrote: > > How to give an ID to my reset button so that I can style it with CSS. > > > Please advise. > > > This is what I have: > > echo $form->button('Reset', array('type'=>'reset')); > > > This is the output: > > > > > This is something like I need to style it: > > > > -- > Bogdan I. Bursuc --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms - How to give an ID or class to my reset button
echo $form->button('Reset', array('type' => 'reset', 'id' => 'resetBtn')); On Sun, 2009-05-03 at 11:15 -0700, Bankai wrote: > How to give an ID to my reset button so that I can style it with CSS. > > Please advise. > > This is what I have: > echo $form->button('Reset', array('type'=>'reset')); > > This is the output: > > > This is something like I need to style it: > > > -- Bogdan I. Bursuc --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms to create Users from another controller
I would do this using the saveAll() function as it saves a good few lines of code, but I believe your issue is that you're not calling $this->User->Employer->create(); before saving your Employer record. However it also seems as though you're doing this back to front?!? If you have created two models, Employer and Contractor, which belong to User then surely you should be using the Employer and Contractor controllers (/employers/register and contractors/register) to manage those objects and save a User at the same time otherwise you would have to add extra logic into the User/register action and view to know which model to associate the new user with? --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not validating while using EmailComponent?
pr($this->validationErrors) in your view will show you the errors. --- Brett Wilton http://wiltonsoftware.com On Fri, Sep 19, 2008 at 12:31 PM, David C. Zentgraf <[EMAIL PROTECTED]> wrote: > > On 18 Sep 2008, at 23:53, 703designs wrote: > >> So a rendered view will automatically receive validation messages? In >> which variable? > > Yes. When a model is validated in the controller, invalid fields will > be noted in a variable. Don't know of the top of my head in which one, > do a debug($this) in the view and you'll find it. You don't need to > worry about it though. The FormHelper automatically picks up on this > variable and prints corresponding error messages. It also picks up on > data in $this->data to fill in form fields, that's how data is "handed > back" to the form. The important thing for this to work is that the > Model.field names are correct, but if it returns to the same form > (read: renders the same view) the data came from this shouldn't be a > problem. > > You can manually invalidate fields in the controller if you want to > test this procedure. > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not validating while using EmailComponent?
On 18 Sep 2008, at 23:53, 703designs wrote: > So a rendered view will automatically receive validation messages? In > which variable? Yes. When a model is validated in the controller, invalid fields will be noted in a variable. Don't know of the top of my head in which one, do a debug($this) in the view and you'll find it. You don't need to worry about it though. The FormHelper automatically picks up on this variable and prints corresponding error messages. It also picks up on data in $this->data to fill in form fields, that's how data is "handed back" to the form. The important thing for this to work is that the Model.field names are correct, but if it returns to the same form (read: renders the same view) the data came from this shouldn't be a problem. You can manually invalidate fields in the controller if you want to test this procedure. > If I need to set a var, what should my target be > ($this->set('errors', /* what here? */))? I tried substituting a > minLength 1 rule yesterday and if it worked, I would not have changed > it, although I can't with certainty say whether validation simply > never happened or if I got these same errors. > > I think that if I render index, that will do the job, as long as I can > get error messages to present. Isn't there a resource about this > (practical form validation)? The blog application, if I recall > correctly, just saves data but doesn't address any fields on an > individual basis, which I need for my template. I know that I'm > missing something, and the Model, View, and Controller sections of the > Cookbook aren't doing much to find the answer (same goes for the > FormHelper and EmailComponent API docs, the latter of which is > definitely a work in progress)? > > On Sep 18, 10:36 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: >> I'm not 100% sure, but I think older versions of Cake required you to >> specify a rule. If you're only interested in the 'required' field, >> specify a rule that'll always validate, like '/.*/' . What version of >> Cake are you using? >> >> Structure your app the way you see fit. It's not good form to use >> index() to add data to the database, but that's up to you to decide. >> Either you make sure that the form submits to the right action (see >> $form->create() options), or that the action renders the appropriate >> view when it's done. What works better for you I don't know. >> >> On 18 Sep 2008, at 23:18, 703designs wrote: >> >>> Right, that was a typo, not a paste. I think that you'll be able to >>> better help me if you understand how I've designed my contact form: >> >>> Model: Contact[name, email, city, subject, message, and a couple >>> others] >>> Model['validate']: Name, email, and message have 'required' => true >>> Views: index (just passes in a pageTitle from the controller and >>> renders a form from the model using $this->form->create('Contact') >>> or >>> equivalent -- works fine. This form automatically mapped to >>> ContactsController::add(), so I created that method and put all of >>> the >>> relevant mail logic in there. >> >>> So should I move this logic into index() and force the form to use >>> that method? Or force a render of the index view and find some way >>> to >>> pass in the validation errors? >> >>> Thanks for the help! >> >>> On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: On 18 Sep 2008, at 21:50, 703designs wrote: >> > I got funny preg_match errors >> Show us your $validate rules then or go through them with a fine comb. >> > $this->Contact->set('$this->data); >> I hope this is not copy&pasted as it's invalid PHP. >> > This controller's 'add' method just sends out emails > and flashes a message to the homepage. What do I need to do for > the > form to point to this method, but for validation errors to show up > on > the form (repopulating fields)? >> What view is your form in then? The add action will automatically try to render the add view, naturally. If this is not where your form is, override it with $this->render(); >> > This is not very well-documented, or > if it is, I had difficulty finding an answer. >> http://book.cakephp.org/view/428/render >> >> > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not validating while using EmailComponent?
So a rendered view will automatically receive validation messages? In which variable? If I need to set a var, what should my target be ($this->set('errors', /* what here? */))? I tried substituting a minLength 1 rule yesterday and if it worked, I would not have changed it, although I can't with certainty say whether validation simply never happened or if I got these same errors. I think that if I render index, that will do the job, as long as I can get error messages to present. Isn't there a resource about this (practical form validation)? The blog application, if I recall correctly, just saves data but doesn't address any fields on an individual basis, which I need for my template. I know that I'm missing something, and the Model, View, and Controller sections of the Cookbook aren't doing much to find the answer (same goes for the FormHelper and EmailComponent API docs, the latter of which is definitely a work in progress)? On Sep 18, 10:36 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > I'm not 100% sure, but I think older versions of Cake required you to > specify a rule. If you're only interested in the 'required' field, > specify a rule that'll always validate, like '/.*/' . What version of > Cake are you using? > > Structure your app the way you see fit. It's not good form to use > index() to add data to the database, but that's up to you to decide. > Either you make sure that the form submits to the right action (see > $form->create() options), or that the action renders the appropriate > view when it's done. What works better for you I don't know. > > On 18 Sep 2008, at 23:18, 703designs wrote: > > > Right, that was a typo, not a paste. I think that you'll be able to > > better help me if you understand how I've designed my contact form: > > > Model: Contact[name, email, city, subject, message, and a couple > > others] > > Model['validate']: Name, email, and message have 'required' => true > > Views: index (just passes in a pageTitle from the controller and > > renders a form from the model using $this->form->create('Contact') or > > equivalent -- works fine. This form automatically mapped to > > ContactsController::add(), so I created that method and put all of the > > relevant mail logic in there. > > > So should I move this logic into index() and force the form to use > > that method? Or force a render of the index view and find some way to > > pass in the validation errors? > > > Thanks for the help! > > > On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > >> On 18 Sep 2008, at 21:50, 703designs wrote: > > >>> I got funny preg_match errors > > >> Show us your $validate rules then or go through them with a fine > >> comb. > > >>> $this->Contact->set('$this->data); > > >> I hope this is not copy&pasted as it's invalid PHP. > > >>> This controller's 'add' method just sends out emails > >>> and flashes a message to the homepage. What do I need to do for the > >>> form to point to this method, but for validation errors to show up > >>> on > >>> the form (repopulating fields)? > > >> What view is your form in then? The add action will automatically try > >> to render the add view, naturally. If this is not where your form is, > >> override it with $this->render(); > > >>> This is not very well-documented, or > >>> if it is, I had difficulty finding an answer. > > >>http://book.cakephp.org/view/428/render > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not validating while using EmailComponent?
I'm not 100% sure, but I think older versions of Cake required you to specify a rule. If you're only interested in the 'required' field, specify a rule that'll always validate, like '/.*/' . What version of Cake are you using? Structure your app the way you see fit. It's not good form to use index() to add data to the database, but that's up to you to decide. Either you make sure that the form submits to the right action (see $form->create() options), or that the action renders the appropriate view when it's done. What works better for you I don't know. On 18 Sep 2008, at 23:18, 703designs wrote: > Right, that was a typo, not a paste. I think that you'll be able to > better help me if you understand how I've designed my contact form: > > Model: Contact[name, email, city, subject, message, and a couple > others] > Model['validate']: Name, email, and message have 'required' => true > Views: index (just passes in a pageTitle from the controller and > renders a form from the model using $this->form->create('Contact') or > equivalent -- works fine. This form automatically mapped to > ContactsController::add(), so I created that method and put all of the > relevant mail logic in there. > > So should I move this logic into index() and force the form to use > that method? Or force a render of the index view and find some way to > pass in the validation errors? > > Thanks for the help! > > On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: >> On 18 Sep 2008, at 21:50, 703designs wrote: >> >>> I got funny preg_match errors >> >> Show us your $validate rules then or go through them with a fine >> comb. >> >>> $this->Contact->set('$this->data); >> >> I hope this is not copy&pasted as it's invalid PHP. >> >>> This controller's 'add' method just sends out emails >>> and flashes a message to the homepage. What do I need to do for the >>> form to point to this method, but for validation errors to show up >>> on >>> the form (repopulating fields)? >> >> What view is your form in then? The add action will automatically try >> to render the add view, naturally. If this is not where your form is, >> override it with $this->render(); >> >>> This is not very well-documented, or >>> if it is, I had difficulty finding an answer. >> >> http://book.cakephp.org/view/428/render > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not validating while using EmailComponent?
Note that each ['validate'] key also has a normal ['message'] defined, saying that the field in question is required. On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > On 18 Sep 2008, at 21:50, 703designs wrote: > > > I got funny preg_match errors > > Show us your $validate rules then or go through them with a fine comb. > > > $this->Contact->set('$this->data); > > I hope this is not copy&pasted as it's invalid PHP. > > > This controller's 'add' method just sends out emails > > and flashes a message to the homepage. What do I need to do for the > > form to point to this method, but for validation errors to show up on > > the form (repopulating fields)? > > What view is your form in then? The add action will automatically try > to render the add view, naturally. If this is not where your form is, > override it with $this->render(); > > > This is not very well-documented, or > > if it is, I had difficulty finding an answer. > > http://book.cakephp.org/view/428/render --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not validating while using EmailComponent?
Right, that was a typo, not a paste. I think that you'll be able to better help me if you understand how I've designed my contact form: Model: Contact[name, email, city, subject, message, and a couple others] Model['validate']: Name, email, and message have 'required' => true Views: index (just passes in a pageTitle from the controller and renders a form from the model using $this->form->create('Contact') or equivalent -- works fine. This form automatically mapped to ContactsController::add(), so I created that method and put all of the relevant mail logic in there. So should I move this logic into index() and force the form to use that method? Or force a render of the index view and find some way to pass in the validation errors? Thanks for the help! On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > On 18 Sep 2008, at 21:50, 703designs wrote: > > > I got funny preg_match errors > > Show us your $validate rules then or go through them with a fine comb. > > > $this->Contact->set('$this->data); > > I hope this is not copy&pasted as it's invalid PHP. > > > This controller's 'add' method just sends out emails > > and flashes a message to the homepage. What do I need to do for the > > form to point to this method, but for validation errors to show up on > > the form (repopulating fields)? > > What view is your form in then? The add action will automatically try > to render the add view, naturally. If this is not where your form is, > override it with $this->render(); > > > This is not very well-documented, or > > if it is, I had difficulty finding an answer. > > http://book.cakephp.org/view/428/render --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not validating while using EmailComponent?
On 18 Sep 2008, at 21:50, 703designs wrote: > I got funny preg_match errors Show us your $validate rules then or go through them with a fine comb. > $this->Contact->set('$this->data); I hope this is not copy&pasted as it's invalid PHP. > This controller's 'add' method just sends out emails > and flashes a message to the homepage. What do I need to do for the > form to point to this method, but for validation errors to show up on > the form (repopulating fields)? What view is your form in then? The add action will automatically try to render the add view, naturally. If this is not where your form is, override it with $this->render(); > This is not very well-documented, or > if it is, I had difficulty finding an answer. http://book.cakephp.org/view/428/render --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not validating while using EmailComponent?
I saw that last night before posting, and wrapping the send sequence in this conditional didn't work: I got funny preg_match errors (also noted here: http://ryan.ifupdown.com/2008/08/24/delimiter-must-not-be-alphanumeric-or-backslash-corecakelibsmodelmodelphp-line-2202/ , although his fix didn't work for me): function add() { if(!empty($this->data)) { $this->Contact->set('$this->data); if($this->Contact->validates()) { // Start sending messages, then flash a success message if successful. Redirect to site root } } } I also got an error about a missing 'add' view which is probably easier to fix. This controller's 'add' method just sends out emails and flashes a message to the homepage. What do I need to do for the form to point to this method, but for validation errors to show up on the form (repopulating fields)? This is not very well-documented, or if it is, I had difficulty finding an answer. On Sep 18, 4:44 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > Are you looking for > this?http://book.cakephp.org/view/410/Validating-Data-from-the-Controller > > On 18 Sep 2008, at 13:51, 703designs wrote: > > > > > How can I check if the data is valid before trying to send the mail > > out? Validation errors are falling into the "email failed" condition, > > and validation errors aren't reported to the user. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not validating while using EmailComponent?
Are you looking for this? http://book.cakephp.org/view/410/Validating-Data-from-the-Controller On 18 Sep 2008, at 13:51, 703designs wrote: > > How can I check if the data is valid before trying to send the mail > out? Validation errors are falling into the "email failed" condition, > and validation errors aren't reported to the user. > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms not associated to models - alternative to the Form core helper?
You may not think it now but your form IS related to a model ;-) See Jonathan snooks example of a contact form: http://snook.ca/archives/cakephp/contact_form_cakephp/ Jonathan creates a tableless model and defines the schema by hand. That way you get all the benefit of cake's helpers (validation etc.) On Aug 26, 5:29 pm, Enrique Delgado <[EMAIL PROTECTED]> wrote: > Thanks Samuel and validkeys. > > Samuel, very true, I do like extending the functionality of CakePHP, > that is probably one of the best ways to go when we need something > more custom. > > This time, I had totally overlooked the regular Form helper methods > like text(), password(), etc. Thanks validkeys for pointing this out. > I was getting too caught up and spoiled by the input() automagic > method, my bad. > > Using the regular methods works just fine. > > Thanks! > > On Aug 26, 11:15 am, validkeys <[EMAIL PROTECTED]> > wrote: > > > Hey Enrique, > > > You could still use the regular forms: > > > create('Search',array('url' => '/search','type' => > > 'get')) ?> > > > text('query',array('type' => 'textarea')) ?> > > > end('Search!') ?> > > > On Aug 26, 11:45 am, Enrique Delgado <[EMAIL PROTECTED]> > > wrote: > > > > Hi All, > > > > The core Form helper works great as long as you have a model behind > > > it, but what about forms that are not related to a model? > > > > Is there any helpers that I can use in the view? Or do I just code > > > plain HTML? > > > > 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@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 -~--~~~~--~~--~--~---
Re: Forms not associated to models - alternative to the Form core helper?
Thanks Samuel and validkeys. Samuel, very true, I do like extending the functionality of CakePHP, that is probably one of the best ways to go when we need something more custom. This time, I had totally overlooked the regular Form helper methods like text(), password(), etc. Thanks validkeys for pointing this out. I was getting too caught up and spoiled by the input() automagic method, my bad. Using the regular methods works just fine. Thanks! On Aug 26, 11:15 am, validkeys <[EMAIL PROTECTED]> wrote: > Hey Enrique, > > You could still use the regular forms: > > create('Search',array('url' => '/search','type' => > 'get')) ?> > > text('query',array('type' => 'textarea')) ?> > > end('Search!') ?> > > On Aug 26, 11:45 am, Enrique Delgado <[EMAIL PROTECTED]> > wrote: > > > Hi All, > > > The core Form helper works great as long as you have a model behind > > it, but what about forms that are not related to a model? > > > Is there any helpers that I can use in the view? Or do I just code > > plain HTML? > > > 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@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 -~--~~~~--~~--~--~---
Re: Forms not associated to models - alternative to the Form core helper?
Hey Enrique, You could still use the regular forms: create('Search',array('url' => '/search','type' => 'get')) ?> text('query',array('type' => 'textarea')) ?> end('Search!') ?> On Aug 26, 11:45 am, Enrique Delgado <[EMAIL PROTECTED]> wrote: > Hi All, > > The core Form helper works great as long as you have a model behind > it, but what about forms that are not related to a model? > > Is there any helpers that I can use in the view? Or do I just code > plain HTML? > > 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@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 -~--~~~~--~~--~--~---
Re: Forms not associated to models - alternative to the Form core helper?
On Tue, Aug 26, 2008 at 8:45 AM, Enrique Delgado <[EMAIL PROTECTED]> wrote: > > Hi All, > > The core Form helper works great as long as you have a model behind > it, but what about forms that are not related to a model? > > Is there any helpers that I can use in the view? Or do I just code > plain HTML? You could make your own helper... based or extending on the FormHelper that doesn't need to be model backed. Though there are ways around (or to work within that limitation) making models that are not DB backed for one, there are other 'tricks' as well. The thing is the time you make a decision to deviate from the expectations and conventions of the design of CakePHP is the time you have to be willing to dig into the code, search around, and to think on your own. It really is not that hard and CakePHP is a lot more flexible then people give it credit for, but 'official documentation' for taking a 'custom' path really should not be expected. I for one love going my own way or bending CakePHP to my will but it takes effort creativity and a willingness to be comfortable digging around and being frustrated. In my humble (mostly) opinion. Have fun dig and share (that last part I need to work on better I am sure) Sam D -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms that add/edit Multiple Models part II
Sorry about that. I am never sure how much to include! Following is the action the form posts to. I have validation rules in both the Agency model and the Member model. But the validation errors from the member model don't show up on a failure. Only the agency errors show and not all of those. What I have here doesn't seem very DRY to me, but usually once I get it working I can clean it up. Another issue I noted was that I have to explicitly remove the agency data if the member save doesn't work. Seems like it should be tied together more tightly. I am currently trying the saveAll you suggested. Thanks for any suggestions! Jee = data)) { $this->Agency->Member->validate($this->data["Member"]); $this->Agency->validate($this->data["Agency"]); $this->Agency->Member->create(); $this->Agency->create(); if ($this->Agency->save($this->data["Agency"])) : if ($this->Agency->Member->save($this->data["Member"])) : $this->Session->setFlash(__('Thank you for joining us! Your new account has been saved', true)); $this->redirect(array('url'=>'/files/signup.pdf')); else : $this->Agency->remove(); $this->Session->setFlash(__('We are sorry but your new account could not be saved. Please, check the Contact Details for errors and try again.', true)); endif; else : $this->Session->setFlash(__('We are sorry but your new account could not be saved. Please, check the Agency Details for errors and try again.', true)); endif; } $referrals = $this->Agency->Referral->find('list'); $this->set(compact('referrals')); } } ?> --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms that add/edit Multiple Models part II
On Thu, Apr 24, 2008 at 2:05 AM, Jee <[EMAIL PROTECTED]> wrote: > > Can anyone give me any suggestions for adding and editing multiple > models from one form in Cake 1.2? A call to saveAll should suffice but it would also help if you showed some code that you are using Tarique -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Forms that add/edit multiple models
As long as the form elements are named using the cake conventions i.e. name="data[ModelName][fieldName]" (best acheived by using the FormHelper functions) there should be no difference between single and multi-model forms. The only difference is when you need to validate both models before saving either. In the controller you need to call $this->ModelOne- >validates() and $this->ModelTwo->validates() before calling the save functions. Also you will need to add $uses = array('ModelOne', 'ModelTwo') to your controller to be able to access both models properly. Geoff -- http://lemoncake.wordpress.com On Sep 19, 5:19 am, nryan <[EMAIL PROTECTED]> wrote: > Hello -- I have another question regarding the 'right way' to do > something with cake. > > I have a form on a page which updates 2 different models. Is there a > recommended way to structure the page in cake? Like, where should the > form-handling logic go? Anyone have a suggested way to make the most > out of cake's validation/saving? > > Thank you!! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---