aboutsummaryrefslogtreecommitdiffstats
path: root/phonegap
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-05-31 13:02:01 +0100
committerStruan Donald <struan@exo.org.uk>2012-05-31 13:02:01 +0100
commit39a974fcbb2240d660857c1239b77f82b9f5433b (patch)
treec5edaef606aeb0a006c6ce90e150b830fe01a9af /phonegap
parent618ea8035bc748368171378780241dfcc6afe737 (diff)
display check details message when logging in and submiting an photo
Diffstat (limited to 'phonegap')
-rw-r--r--phonegap/www/js/mobile.js34
1 files changed, 21 insertions, 13 deletions
diff --git a/phonegap/www/js/mobile.js b/phonegap/www/js/mobile.js
index 01c87fab4..f580ee0bf 100644
--- a/phonegap/www/js/mobile.js
+++ b/phonegap/www/js/mobile.js
@@ -183,6 +183,21 @@ function takePhotoFail(message) {
function takePhoto(type) {
navigator.camera.getPicture(takePhotoSuccess, takePhotoFail, { quality: 50, destinationType: Camera.DestinationType.FILE_URI, sourceType: type });
}
+
+function check_name( name, msg ) {
+ $('#email_label').hide();
+ $('#form_email').hide();
+ $('#now_submit').hide();
+ $('#have_password').hide();
+ $('#form_sign_in_yes').hide();
+ $('#let_me_confirm').hide();
+ $('#password_register').hide();
+ $('#password_surround').hide();
+ $('#providing_password').hide();
+ $('#form_name').val( name );
+ $('#form_name').focus();
+ $('#form_name').before('<div class="form-error">' + msg + '</div>' );
+}
function fileUploadSuccess(r) {
console.log( r.response );
@@ -197,7 +212,11 @@ function fileUploadSuccess(r) {
window.location = 'email_sent.html';
}
} else {
- alert('Could not submit report');
+ if ( data.check_name ) {
+ check_name( data.check_name, data.errors.name );
+ } else {
+ alert('Could not submit report');
+ }
$('input[type=submit]').prop("disabled", false);
}
} else {
@@ -272,18 +291,7 @@ function postReport(e) {
}
} else {
if ( data.check_name ) {
- $('#email_label').hide();
- $('#form_email').hide();
- $('#now_submit').hide();
- $('#have_password').hide();
- $('#form_sign_in_yes').hide();
- $('#let_me_confirm').hide();
- $('#password_register').hide();
- $('#password_surround').hide();
- $('#providing_password').hide();
- $('#form_name').val( data.check_name );
- $('#form_name').focus();
- $('#form_name').before('<div class="form-error">' + data.errors.name + '</div>' );
+ check_name( data.check_name, data.errors.name );
}
$('input[type=submit]').prop("disabled", false);
}