mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Validate invoice form when submitted by clicking enter
This commit is contained in:
parent
e3a2605d3e
commit
85c99c76bd
@ -38,6 +38,7 @@
|
|||||||
->method($method)
|
->method($method)
|
||||||
->addClass('warn-on-exit')
|
->addClass('warn-on-exit')
|
||||||
->autocomplete('off')
|
->autocomplete('off')
|
||||||
|
->onsubmit('return onFormSubmit(event)')
|
||||||
->rules(array(
|
->rules(array(
|
||||||
'client' => 'required',
|
'client' => 'required',
|
||||||
'invoice_number' => 'required',
|
'invoice_number' => 'required',
|
||||||
@ -52,7 +53,7 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body" style="padding-bottom: 0px;">
|
<div class="panel-body" style="padding-bottom: 0px;">
|
||||||
|
|
||||||
<div class="row" style="min-height:195px" onkeypress="formEnterClick(event)" onsubmit="onSubmit()">
|
<div class="row" style="min-height:195px" onkeypress="formEnterClick(event)">
|
||||||
<div class="col-md-4" id="col_1">
|
<div class="col-md-4" id="col_1">
|
||||||
|
|
||||||
@if ($invoice->id || $data)
|
@if ($invoice->id || $data)
|
||||||
@ -1055,13 +1056,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onEmailClick() {
|
function onEmailClick() {
|
||||||
if (!isEmailValid()) {
|
if (!NINJA.isRegistered) {
|
||||||
alert("{!! trans('texts.provide_email') !!}");
|
alert("{!! trans('texts.registration_required') !!}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NINJA.isRegistered) {
|
if (!isEmailValid()) {
|
||||||
alert("{!! trans('texts.registration_required') !!}");
|
alert("{!! trans('texts.provide_email') !!}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1107,9 +1108,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submitAction(value) {
|
function submitAction(value) {
|
||||||
|
$('#action').val(value);
|
||||||
|
$('#submitButton').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onFormSubmit(event) {
|
||||||
if (!isSaveValid()) {
|
if (!isSaveValid()) {
|
||||||
model.showClientForm();
|
model.showClientForm();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check currency matches for expenses
|
// check currency matches for expenses
|
||||||
@ -1117,16 +1123,11 @@
|
|||||||
var clientCurrencyId = model.invoice().client().currency_id() || {{ $account->getCurrencyId() }};
|
var clientCurrencyId = model.invoice().client().currency_id() || {{ $account->getCurrencyId() }};
|
||||||
if (expenseCurrencyId && expenseCurrencyId != clientCurrencyId) {
|
if (expenseCurrencyId && expenseCurrencyId != clientCurrencyId) {
|
||||||
alert("{!! trans('texts.expense_error_mismatch_currencies') !!}");
|
alert("{!! trans('texts.expense_error_mismatch_currencies') !!}");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onPartialChange(true);
|
onPartialChange(true);
|
||||||
$('#action').val(value);
|
|
||||||
$('#submitButton').click();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubmit() {
|
|
||||||
console.log('submit');
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user