Permalink
Browse files

Updating docs for serializeForm.

Making url for form js more flexible.
  • Loading branch information...
1 parent 36722c0 commit e8b39fb9a522e4afe680a8782e038d721ad79f7c @markstory markstory committed Jul 25, 2009
Showing with 15 additions and 6 deletions.
  1. +15 −6 cake/libs/view/helpers/js.php
View
21 cake/libs/view/helpers/js.php
@@ -257,13 +257,18 @@ function submit($caption = null, $options = array()) {
$out = $this->Form->submit($caption, $htmlOptions);
$this->get('#' . $htmlOptions['id']);
- $options['data'] = $this->serializeForm('#' . $htmlOptions);
- $requestString = '';
+ $options['data'] = $this->serializeForm(false);
+ $requestString = $url = '';
if (isset($options['confirm'])) {
$requestString = $this->confirmReturn($options['confirm']);
unset($options['confirm']);
}
- $requestString .= $this->request('', $options);
+ if (isset($options['url'])) {
+ $url = $options['url'];
+ unset($options['url']);
+ }
+
+ $requestString .= $this->request($url, $options);
if (!empty($requestString)) {
$event = $this->event('click', $requestString, $options);
}
@@ -790,9 +795,13 @@ function slider() {
trigger_error(sprintf(__('%s does not have slider() implemented', true), get_class($this)), E_USER_WARNING);
}
/**
- * serializeForm
- *
- * @return string Completed form serialization script
+ * Serialize the form attached to $selector.
+ * Pass `true` for $isForm if the current selection is a form element.
+ * Converts the form or the form element attached to the current selection into a string/json object
+ * (depending on the library implementation) for use with XHR operations.
+ *
+ * @param boolean $isForm is the current selection a form?
+ * @return string completed form serialization script
**/
function serializeForm() {
trigger_error(

0 comments on commit e8b39fb

Please sign in to comment.