Re: How to stop ajax submition?

2006-07-21 Thread Daniel King

Great! I found the solution by myself.

Put the js codes for validation into $option['before'] instead of the
form's attribute "onsubmit" can solve my problerm.


Like this:


'/news/add',
'update' =>'newListBox',
'before'=>'MyprettyValidateFunction();'


'complete'=>$ajax->remoteFunction(array('url'=>'/news/show/latest','update'­­=>'newsContent')),



'class'=>'btn'
);
echo $ajax->submit('Post', $options);
?>


if MyprettyValidateFunction() returns false, no submition happends.


--~--~-~--~~~---~--~~
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: How to stop ajax submition?

2006-07-21 Thread Daniel King

Great! I found the solution by myself.

Put the js codes for validation into $option['before'] instead of the
form's attribute "onsubmit" can solve my problerm.

Like this:

'/news/add',
'update' =>'newListBox',
'before'=>'MyprettyValidateFunction();'

'complete'=>$ajax->remoteFunction(array('url'=>'/news/show/latest','update'­=>'newsContent')),

'class'=>'btn'
);
echo $ajax->submit('Post', $options);
?>

if MyprettyValidateFunction() returns false, no submition happend.


--~--~-~--~~~---~--~~
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: How to stop ajax submition?

2006-07-21 Thread Daniel King

here's my code:


but no messagebox shown.

the form was not really submiied.

here's the "submit" button:
'/news/add',
'update' =>'newListBox',

'complete'=>$ajax->remoteFunction(array('url'=>'/news/show/latest','update'=>'newsContent')),
'class'=>'btn'
);
echo $ajax->submit('Post', $options); 
?>


--~--~-~--~~~---~--~~
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: How to stop ajax submition?

2006-07-20 Thread lorenzo


Daniel King ha scritto:

> I am sorry to say that this way doesn't works either.
sure, it's example
function MyprettyValidateFunction()
{
//some interesting action ..
   if(true)
   {
 new Ajax.Updater(level,option)
//other
}

}


--~--~-~--~~~---~--~~
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: How to stop ajax submition?

2006-07-20 Thread Daniel King

I am sorry to say that this way doesn't works either.
If I "submit" a form by using ajax, the form will not be really
submitted.
So the event submit will not be activated.


--~--~-~--~~~---~--~~
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: How to stop ajax submition?

2006-07-20 Thread lorenzo


Daniel King ha scritto:

> But your way also needs a request.
> I want to do it at the client.
I suppose you are talking about a tipical "cake" scenario.
You can use javascript as you want
in your view:

function MyprettyValidateFunction()
{
//some interesting action ..
}


and your form:

Hope this ask your question!


--~--~-~--~~~---~--~~
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: How to stop ajax submition?

2006-07-20 Thread Daniel King

But your way also needs a request.
I want to do it at the client.


--~--~-~--~~~---~--~~
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: How to stop ajax submition?

2006-07-20 Thread lorenzo


Daniel King ha scritto:

> I want to use javascript to validate some fields before I submit an
> ajax form. How?
Create a method ajax_check in your controller.

Put an observe fields to monitorate the user entry.

For example echo $ajax->observeField('Name',
array('update'=>'error_message', 'url'=>"/UController/ajax_check",
'frequency'=>0.2));
Optionally you can disable submit form if error_message.innerHTML is
"No".

Have fun!


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