mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 22:22:32 +01:00
Correct validation and modify function
Validation Function will now ask you if you want to continue when mail settings are incorrect
This commit is contained in:
parent
4f775fa432
commit
efcc92ee0e
@ -101,7 +101,7 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.NINJA_APP_URL.'/terms" target="_blank">'.trans('texts.terms_of_service').'</a>'])) !!}
|
{!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.NINJA_APP_URL.'/terms" target="_blank">'.trans('texts.terms_of_service').'</a>'])) !!}
|
||||||
{!! Former::actions( Button::primary('Submit')->withAttributes(['onclick' => 'validate()']) ) !!}
|
{!! Former::actions( Button::primary('Submit')->submit() ) !!}
|
||||||
{!! Former::close() !!}
|
{!! Former::close() !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -160,14 +160,25 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
return mail_valid;
|
return mail_valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate()
|
// Validate Settings
|
||||||
|
$('form button[type="submit"]').click( function(e)
|
||||||
{
|
{
|
||||||
// First check if they have already validated the setting if not check them
|
// Check DB Settings
|
||||||
if( ( db_valid && mail_valid ) || (testDatabase() && testMail()) ) {
|
if( !db_valid || !testDatabase() ) {
|
||||||
$("form").submit();
|
alert('Please check your Database Settings.');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
alert('Please double check your settings.');
|
|
||||||
|
// If Mail Settings are incorrect, prompt for continue
|
||||||
|
if( !mail_valid || !testMail() ) {
|
||||||
|
var check = confirm("The mail settings are incomplete.\nAre you sure you want to continue?");
|
||||||
|
if (!check) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
// Prevent the Enter Button from working
|
// Prevent the Enter Button from working
|
||||||
$("form").bind("keypress", function (e) {
|
$("form").bind("keypress", function (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user