Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
290462c9
Commit
290462c9
authored
Nov 07, 2006
by
Richard Mansfield
Browse files
Comments
parent
0309529d
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/form.php
View file @
290462c9
...
...
@@ -443,11 +443,10 @@ class Form {
$result
.
=
"</form>
\n
"
;
if
(
$this
->
ajaxpost
)
{
$inlinejs
=
'<script language="javascript" type="text/javascript">'
;
$inlinejs
.
=
$this
->
validate_js
();
$inlinejs
.
=
$this
->
submit_js
();
$inlinejs
.
=
"</script>
\n
"
;
return
$result
.
$inlinejs
;
$result
.
=
'<script language="javascript" type="text/javascript">'
;
$result
.
=
$this
->
validate_js
();
$result
.
=
$this
->
submit_js
();
$result
.
=
"</script>
\n
"
;
}
return
$result
;
...
...
@@ -626,6 +625,8 @@ class Form {
/**
* Returns a js function to submit an ajax form
* Expects formname_message() to be defined by the renderer,
* and formname_validate() to be defined.
*/
private
function
submit_js
()
{
$result
=
'function '
.
$this
->
name
.
"_submit(){\n"
;
...
...
@@ -636,8 +637,10 @@ class Form {
foreach
(
$this
->
get_elements
()
as
$element
)
{
$result
.
=
"data['"
.
$element
[
'name'
]
.
"'] = $('"
.
$element
[
'name'
]
.
"').value;
\n
"
;
}
// This does a post. Gets are much simpler in mochikit and we could check whether
// there are any big fields (wysiwyg,textarea) and do a get here if there aren't any.
// This does a post. Gets are much simpler in mochikit and we
// could check whether there are any big fields (like wysiwyg,
// textarea) and do a get (doSimpleXmlHttpRequest) instead if
// there aren't any.
$result
.
=
'var req = getXMLHttpRequest();'
;
$result
.
=
"req.open('POST','"
.
$this
->
ajaxformhandler
.
"');
\n
"
;
$result
.
=
"req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
\n
"
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment