Re: how can i create forms on the fly using ajax without requiring a div container to be previously created?

2008-03-29 Thread Zoltan

Not sure if this is what you're looking for, but there's a jQuery plug-
in called LiveQuery that lets you catch if there's been updates to the
page. I use this because I wanted some text to show when validation
failed (realized later there might have been another way, but
anyways...), here's the code:

// picks up if the 'error' class is/isn't present in the '#postal'
element; if so, displays error message block
$(document).ready(function(){
var matched = function() {
$('#no_delivery_msg').fadeIn();
};
var unmatched = function() {
$('#no_delivery_msg').hide();
};

$('#UserPostal[class*=error]').livequery( matched, unmatched );
}
});

Essentially the validation plug-in adds a CSS error class to the field
if it doesn't validate, the plug-in catches this event and shows the
message.


On Mar 28, 4:46 pm, Baz <[EMAIL PROTECTED]> wrote:
> To my knowledge, not from within CakePHP (but this is off the top of my
> head), because you can only do DOM element updates.
>
> You'd have to do some manual Ajax through your JS framework. To catch the
> ajax response and do an Append to the DOM element instead of a the Replace.
>
> Doesn't help much, I'm sorry.
>
> On Fri, Mar 28, 2008 at 2:33 PM, miuuzn <[EMAIL PROTECTED]> wrote:
>
> > i've been looking for a way to make a variable number of forms and
> > manage them(add or remove) on the client using 2 buttons
>
> > i found the way to update  div, but it does not fit my requirement...
> > as if i update the whole div i would have to recreate all the forms.
> > And i can't have a div for each form on the view, because its
> > variable.
>
> > is there a way to just add a DIV or FORM without reloading the others?
> > and also removing divs or forms...
>
> > 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?hl=en
-~--~~~~--~~--~--~---



Re: how can i create forms on the fly using ajax without requiring a div container to be previously created?

2008-03-28 Thread Baz
To my knowledge, not from within CakePHP (but this is off the top of my
head), because you can only do DOM element updates.

You'd have to do some manual Ajax through your JS framework. To catch the
ajax response and do an Append to the DOM element instead of a the Replace.

Doesn't help much, I'm sorry.

On Fri, Mar 28, 2008 at 2:33 PM, miuuzn <[EMAIL PROTECTED]> wrote:

>
> i've been looking for a way to make a variable number of forms and
> manage them(add or remove) on the client using 2 buttons
>
> i found the way to update  div, but it does not fit my requirement...
> as if i update the whole div i would have to recreate all the forms.
> And i can't have a div for each form on the view, because its
> variable.
>
> is there a way to just add a DIV or FORM without reloading the others?
> and also removing divs or forms...
>
> 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?hl=en
-~--~~~~--~~--~--~---



how can i create forms on the fly using ajax without requiring a div container to be previously created?

2008-03-28 Thread miuuzn

i've been looking for a way to make a variable number of forms and
manage them(add or remove) on the client using 2 buttons

i found the way to update  div, but it does not fit my requirement...
as if i update the whole div i would have to recreate all the forms.
And i can't have a div for each form on the view, because its
variable.

is there a way to just add a DIV or FORM without reloading the others?
and also removing divs or forms...

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?hl=en
-~--~~~~--~~--~--~---