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
b91fbf4c
Commit
b91fbf4c
authored
Jul 14, 2015
by
Robert Lyon
Committed by
Gerrit Code Review
Jul 14, 2015
Browse files
Merge "Bug 1469569: Allow fields to show on form error page load"
parents
209b78f1
7c632e6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/auth/lib.php
View file @
b91fbf4c
...
...
@@ -2237,25 +2237,18 @@ function auth_generate_registration_form_js($aform, $registerconfirm) {
$js
=
'
var registerconfirm = '
.
json_encode
(
$registerconfirm
)
.
';
jQuery(function($) {
$("#'
.
$institutionid
.
'").change(function() {
if (this.value && registerconfirm[this.value] == 1) {
$("#'
.
$reasonid
.
'_container").removeClass("js-hidden");
$("#'
.
$reasonid
.
'_container textarea").removeClass("js-hidden");
$("#'
.
$reasonid
.
'_container").next("tr.textarea").removeClass("js-hidden");
}
else {
$("#'
.
$reasonid
.
'_container").addClass("js-hidden");
$("#'
.
$reasonid
.
'_container textarea").addClass("js-hidden");
$("#'
.
$reasonid
.
'_container").next("tr.textarea").addClass("js-hidden");
}
// need to fetch the correct terms and conditions for the institution
if (this.value) {
function show_reason(reasonid, value) {
if (value) {
$("#" + reasonid + "_container").removeClass("js-hidden");
$("#" + reasonid + "_container textarea").removeClass("js-hidden");
$("#" + reasonid + "_container").next("tr.textarea").removeClass("js-hidden");
// need to fetch the correct terms and conditions for the institution
$.ajax({
type: "POST",
dataType: "json",
url: "'
.
$url
.
'",
data: {
"institution":
this.
value,
"institution": value,
}
}).done(function (data) {
if (data.content) {
...
...
@@ -2263,6 +2256,27 @@ function auth_generate_registration_form_js($aform, $registerconfirm) {
}
});
}
else {
$("#" + reasonid + "_container").addClass("js-hidden");
$("#" + reasonid + "_container textarea").addClass("js-hidden");
$("#" + reasonid + "_container").next("tr.textarea").addClass("js-hidden");
}
}
// For when page loads after error found on form completion
var defaultselect = $j("#'
.
$institutionid
.
'").val();
var reasonid = "'
.
$reasonid
.
'";
if (defaultselect != 0 && registerconfirm[defaultselect] == 1) {
show_reason(reasonid, defaultselect);
}
// For when select changes
$("#'
.
$institutionid
.
'").change(function() {
if (this.value && registerconfirm[this.value] == 1) {
show_reason(reasonid, this.value);
}
else {
show_reason(reasonid, null);
}
});
});
'
;
...
...
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