Re: Validating against non-model data

2006-07-02 Thread Sam

Thanks for your reply, Attila, obviously I'm new this framework as
well. My whole reason for posting this is so someone can say, with some
authority, how this sort of thing should be done and why.

Here's my response regarding your suggestions: it seems like putting my
special invalidations inside the validate() or beforeValidate()
functions would mean putting it into the model. My problem with that is
these data fields (the confirm fields) exist ONLY for this one page and
because they are effectively temporary (never go to the database), it
seems inappropriate to refer to them anywhere in the model (which to
me, means permanent data for addressing in the database).

Of course, I recognize my reasoning could be flawed here, so if someone
could indicate a valid approach, I would be extremely thankful.

-Sam


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Validating against non-model data

2006-07-02 Thread AD7six

Hi Sam,

If you follow Attila's second solution changing your code to be:

/ Try to save as normal, shouldn't work if the field was
invalidated.
if ($this-User-validates($this-data)) {
$this-User-save($this-data, false)
// don't need to try and validate twice, will still work fine with the
second parameter ommited
$this-flash('You have been
successfully registered.',
'/users/login');
} else {
$this-render();
}

You should have the result you are looking for. If you have custom
validations of any kind I think this is the best approach.

Cheers,

AD7six


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Controller argument causing update instead of insert

2006-07-02 Thread aka

Hi!

I was having similar problems, but Nate helped me out in this thread:
http://groups.google.com/group/cake-php/browse_thread/thread/d06d4f9f84bb343d/7225681b65c6ce43

Berhaps you are facing similar situation as I were?

-Antti


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Ajax div/divEnd versus div /div

2006-07-02 Thread francky06l

Hi all,

I am using Ajax helper and also Cajax helper. I am learning slowly and
I experiment slowly. The Cajax helper helps a lot (normal for an
helper), but I do not know when to use normal div and $ajax-div()..
What is the difference, I have used both in my rending view (ie :
e($ajax-div()) to change the inside code of a div, but without doing
this it seems to work as well...

Maybe when updating multiple div ?

I have 2 others questions ..

1) I have a page with 2 divs, the first div contains some php code, the
second div html. With a single call I want to update both as follow :
- execute again the code within the first div (a kind of refresh)
- render a view to update the second div with other html parts ..

I failed to do it, unless I repeat the code of the first div into my
rendered thtml ..Is there any other way ?

2) I have setup the cake application with a sign-in. The first page
loaded, whatever link used, will check the user logged and render a
login view using the default.thtml layout.
This default layout is a 3 columnds based, the left div is a menu, the
center div the content and the right div another menu.
Basically after signing, I do everything in ajax to update the middle
div. The menus appears only after signing ( I set a variable and the
default layour will make requestAction to make them appear).
I control if user is sign in in the beforeFilter of the
app_controller.php. If the Session does not contains my user, I
redirect to the User controller that cleans up eventual info in the
Session and redirect to the Login view.
That's works perfect until, I reach the session cleaning after 20
minutes ..and I was previously into the application, thus using Ajax to
manipulate the main div. At this point the user/control works and
redirects me into the login page, but this page appear with the
defult.thtml into the middle div. At that point I would rather prefer
to get out of Ajax, clean up the screen and render the view as when I
start .. Any idea ?
I also got a problem of redirect into controllers when that function
should call another function to update my view ..again the default
layout is included in it (I have used the $cajax-form ...) but no much
success..

Thanks a lot


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Ajax div/divEnd versus div /div

2006-07-02 Thread nate

Refer to the following:
http://groups.google.com/group/cake-php/msg/cf10b929a33db24e

The Ajax methods only render div tags when a request is not
specifically made to update that div, otherwise, only the contents of
that div are rendered, and not the tag or surrounding content.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Ajax div/divEnd versus div /div

2006-07-02 Thread francky06l

Thanks nate.

In other words, in my example (with 2 divs) .

I create the inititial document with normal div, then I make my link
but I do not specify any 'update' options.
In my render div, I do not mentionned the first div (or should I ?) but
for the second I use the  e($ajax-div()) method ?
I have seen the topic mentionned, now how would look like the
test.thtml if the page is modified like this :

?=$ajax-div('second'); ?
h1Initial header/h1
?=$ajax-divEnd('second'); ?

in my controller/test method, I want to change the content of the
second div by :
h1Updated div/h1
AND also update the first div with the current time, but without
writing again the php code into the render view?

Thanks for your patience


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Validating against non-model data

2006-07-02 Thread Sam

Thanks for the clarification, AD7six, I think I've got it now. And yes,
it does make a bit more sense. :)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Ajax div/divEnd versus div /div

2006-07-02 Thread nate

Not exactly.

When using div/divEnd, you *must* specify one or more div id's in the
'update' key of the link, so that the div's will know how to render.
In your example above, you should put 'update' = 'second' in your Ajax
link.

Also, while you can update the div's in one view with content from
another view, the original design idea behind these methods was to
allow you to write one view template to serve both HTML *and* Ajax
requests.  Maybe that'll help it make a little more sense.  I know it's
a little bit much to wrap your head around.  If I were you, I'd start
with some basic Ajax app design, i.e. write one view for the initial
request, and one view for each element of the page you'd like to
updatem until you start getting a feel for the way Cake handles Ajax
views and updates.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Ajax div/divEnd versus div /div

2006-07-02 Thread francky06l

Thanks again, I think I have got the picture, however I can also use
'update' when I do not have div/divend
Basically you can use div/divend only when they are mentionned into
your Ajax calls. I have already done plenty of update but I wounder if
there is a wayt to the basic question :

- updating 2 divs, one having just a refresh of code (ie : as the
sample) and another having view to place into the div .. All this in
a simple call, I have tried with the sample and did not manage to make
it work ..
In fact, usually in my app I update only on div at a time, but I have
wrapped up some javascript to highlight automatically the current  tab
menu..(from the $base and $here values) .. I wanted to put that js call
in a div and just refresh it when I change any page ..

Thanks for you help


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Strange session problems ;-(

2006-07-02 Thread AD7six

Hi Vladiq,

To fix this problem

create /app/views/layouts/default.thtml and design your general page
layout (or copy from /cake/lib/view/templates/layouts/default.thtml)
and make sure that the path to the favicon is absolute (or simply
remove it).

Hope that helps, Cheers,

AD7six
For reference:
http://www.cakephp.org/search?q=favicon+session


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Ajax div/divEnd versus div /div

2006-07-02 Thread francky06l

Thanks nate, I follow your advises and made plenty of small samples and
check the request and the layout using Firebug.
Well I understand now the usage of $ajax-div() etc ...

I am thinking of the best way to organize my application, in fact as I
said I have a central div that is used for differents things. Best
approach maybe would be to have an HTML for each of differents area
and then use Ajax to update the div inside areas of work ? But I guess
is not that simple...

Is there a sample of a Cake dev, entirely done using Ajax and
manipulating differents controllers and views that I could use for
experimenting ?

Thanks


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



multiple views in one page?

2006-07-02 Thread PaulM

I have a page that consists of a registration form on the left and
user listing on the right.
I want the registration page to be separate view or element and the
user listing another separate element.

How do I create two elements like that. They both have their own
controllers.

Thanks


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: multiple views in one page?

2006-07-02 Thread Olivier Percebois-Garve

Use RequestAction().

for instance let's say you have controller Registration with method 
edit($step) and you want the output of controller User method 
listening($cat_id)
you use to call the adress registration/edit/1
transform edit($step) in edit($step, cat_id)
inside the method use RequestAction('User/listening'.$cat_id) in 
combination with set()

Look at the manual about RequestAction()

olivvv

PaulM wrote:
 I have a page that consists of a registration form on the left and
 user listing on the right.
 I want the registration page to be separate view or element and the
 user listing another separate element.

 How do I create two elements like that. They both have their own
 controllers.

 Thanks


 

   


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---