Corrected form autocomplete behavior

This commit is contained in:
Hillel Coren 2015-11-09 16:53:18 +02:00
parent 7542cb479f
commit 02aa10e41d
8 changed files with 152 additions and 91 deletions

View File

@ -31628,7 +31628,7 @@ function GetPdfMake(invoice, javascript, callback) {
} }
// only show the footer on the last page // only show the footer on the last page
if (key === 'footer') { if (invoice.is_pro && key === 'footer') {
return function(page, pages) { return function(page, pages) {
return page === pages ? val : ''; return page === pages ? val : '';
} }
@ -31638,6 +31638,7 @@ function GetPdfMake(invoice, javascript, callback) {
if (key === 'text') { if (key === 'text') {
val = NINJA.parseMarkdownText(val, true); val = NINJA.parseMarkdownText(val, true);
} }
/* /*
if (key === 'stack') { if (key === 'stack') {
val = NINJA.parseMarkdownStack(val); val = NINJA.parseMarkdownStack(val);

View File

@ -55,7 +55,7 @@ function GetPdfMake(invoice, javascript, callback) {
} }
// only show the footer on the last page // only show the footer on the last page
if (key === 'footer') { if (invoice.is_pro && key === 'footer') {
return function(page, pages) { return function(page, pages) {
return page === pages ? val : ''; return page === pages ? val : '';
} }
@ -65,6 +65,7 @@ function GetPdfMake(invoice, javascript, callback) {
if (key === 'text') { if (key === 'text') {
val = NINJA.parseMarkdownText(val, true); val = NINJA.parseMarkdownText(val, true);
} }
/* /*
if (key === 'stack') { if (key === 'stack') {
val = NINJA.parseMarkdownStack(val); val = NINJA.parseMarkdownStack(val);

View File

@ -18,9 +18,12 @@
</style> </style>
{!! Former::open_for_files()->addClass('warn-on-exit')->rules(array( {!! Former::open_for_files()
'name' => 'required', ->addClass('warn-on-exit')
)) !!} ->autocomplete('on')
->rules([
'name' => 'required'
]) !!}
{{ Former::populate($account) }} {{ Former::populate($account) }}
@ -62,13 +65,14 @@
</div> </div>
<div class="panel-body form-padding-right"> <div class="panel-body form-padding-right">
{!! Former::text('address1') !!} {!! Former::text('address1')->autocomplete('address-line1') !!}
{!! Former::text('address2') !!} {!! Former::text('address2')->autocomplete('address-line2') !!}
{!! Former::text('city') !!} {!! Former::text('city')->autocomplete('address-level2') !!}
{!! Former::text('state') !!} {!! Former::text('state')->autocomplete('address-level1') !!}
{!! Former::text('postal_code') !!} {!! Former::text('postal_code')->autocomplete('postal-code') !!}
{!! Former::select('country_id')->addOption('','') {!! Former::select('country_id')
->fromQuery($countries, 'name', 'id') !!} ->addOption('','')
->fromQuery($countries, 'name', 'id') !!}
</div> </div>
</div> </div>

View File

@ -14,11 +14,14 @@
<div class="row"> <div class="row">
{!! Former::open($url) {!! Former::open($url)
->autocomplete('off')
->rules( ->rules(
['email' => 'email'] ['email' => 'email']
)->addClass('col-md-12 warn-on-exit') )->addClass('col-md-12 warn-on-exit')
->method($method) !!} ->method($method) !!}
@include('partials.autocomplete_fix')
@if ($client) @if ($client)
{!! Former::populate($client) !!} {!! Former::populate($client) !!}
{!! Former::hidden('public_id') !!} {!! Former::hidden('public_id') !!}

View File

@ -539,7 +539,7 @@
<div style="background-color: #fff; padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onclick="validateSignUp()" onkeydown="checkForEnter(event)"> <div style="background-color: #fff; padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onclick="validateSignUp()" onkeydown="checkForEnter(event)">
<br/> <br/>
{!! Former::open('signup/submit')->addClass('signUpForm') !!} {!! Former::open('signup/submit')->addClass('signUpForm')->autocomplete('on') !!}
@if (Auth::check()) @if (Auth::check())
{!! Former::populateField('new_first_name', Auth::user()->first_name) !!} {!! Former::populateField('new_first_name', Auth::user()->first_name) !!}
@ -580,10 +580,23 @@
@endif @endif
{{ Former::setOption('TwitterBootstrap3.labelWidths.large', 1) }} {{ Former::setOption('TwitterBootstrap3.labelWidths.large', 1) }}
{{ Former::setOption('TwitterBootstrap3.labelWidths.small', 1) }} {{ Former::setOption('TwitterBootstrap3.labelWidths.small', 1) }}
{!! Former::text('new_first_name')->placeholder(trans('texts.first_name'))->label(' ') !!}
{!! Former::text('new_last_name')->placeholder(trans('texts.last_name'))->label(' ') !!} {!! Former::text('new_first_name')
{!! Former::text('new_email')->placeholder(trans('texts.email'))->label(' ') !!} ->placeholder(trans('texts.first_name'))
{!! Former::password('new_password')->placeholder(trans('texts.password'))->label(' ') !!} ->autocomplete('given-name')
->label(' ') !!}
{!! Former::text('new_last_name')
->placeholder(trans('texts.last_name'))
->autocomplete('family-name')
->label(' ') !!}
{!! Former::text('new_email')
->placeholder(trans('texts.email'))
->autocomplete('email')
->label(' ') !!}
{!! Former::password('new_password')
->placeholder(trans('texts.password'))
->label(' ') !!}
{{ Former::setOption('TwitterBootstrap3.labelWidths.large', 4) }} {{ Former::setOption('TwitterBootstrap3.labelWidths.large', 4) }}
{{ Former::setOption('TwitterBootstrap3.labelWidths.small', 4) }} {{ Former::setOption('TwitterBootstrap3.labelWidths.small', 4) }}
</div> </div>

View File

@ -30,12 +30,17 @@
</ol> </ol>
@endif @endif
{!! Former::open($url)->method($method)->addClass('warn-on-exit')->rules(array( {!! Former::open($url)
'client' => 'required', ->method($method)
'invoice_number' => 'required', ->addClass('warn-on-exit')
'product_key' => 'max:255' ->autocomplete('off')
)) !!} ->rules(array(
'client' => 'required',
'invoice_number' => 'required',
'product_key' => 'max:255'
)) !!}
@include('partials.autocomplete_fix')
<input type="submit" style="display:none" name="submitButton" id="submitButton"> <input type="submit" style="display:none" name="submitButton" id="submitButton">

View File

@ -0,0 +1,4 @@
<!-- http://stackoverflow.com/a/30873633/497368 -->
<div style="display: none;">
<input type="text" id="PreventChromeAutocomplete" name="PreventChromeAutocomplete" autocomplete="address-level4" />
</div>

View File

@ -133,21 +133,23 @@ header h3 em {
</style> </style>
{!! Former::vertical_open($url)->rules(array( {!! Former::vertical_open($url)
'first_name' => 'required', ->autocomplete('on')
'last_name' => 'required', ->rules(array(
'card_number' => 'required', 'first_name' => 'required',
'expiration_month' => 'required', 'last_name' => 'required',
'expiration_year' => 'required', 'card_number' => 'required',
'cvv' => 'required', 'expiration_month' => 'required',
'address1' => 'required', 'expiration_year' => 'required',
'city' => 'required', 'cvv' => 'required',
'state' => 'required', 'address1' => 'required',
'postal_code' => 'required', 'city' => 'required',
'country_id' => 'required', 'state' => 'required',
'phone' => 'required', 'postal_code' => 'required',
'email' => 'required|email' 'country_id' => 'required',
)) !!} 'phone' => 'required',
'email' => 'required|email'
)) !!}
@if ($client) @if ($client)
{{ Former::populate($client) }} {{ Former::populate($client) }}
@ -191,16 +193,25 @@ header h3 em {
<h3>{{ trans('texts.contact_information') }}</h3> <h3>{{ trans('texts.contact_information') }}</h3>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
{!! Former::text('first_name')->placeholder(trans('texts.first_name'))->label('') !!} {!! Former::text('first_name')
->placeholder(trans('texts.first_name'))
->autocomplete('given-name')
->label('') !!}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{!! Former::text('last_name')->placeholder(trans('texts.last_name'))->label('') !!} {!! Former::text('last_name')
->placeholder(trans('texts.last_name'))
->autocomplete('family-name')
->label('') !!}
</div> </div>
</div> </div>
@if (isset($paymentTitle)) @if (isset($paymentTitle))
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
{!! Former::text('email')->placeholder(trans('texts.email'))->label('') !!} {!! Former::text('email')
->placeholder(trans('texts.email'))
->autocomplete('email')
->label('') !!}
</div> </div>
</div> </div>
@endif @endif
@ -211,26 +222,45 @@ header h3 em {
<h3>{{ trans('texts.billing_address') }} &nbsp;<span class="help">{{ trans('texts.payment_footer1') }}</span></h3> <h3>{{ trans('texts.billing_address') }} &nbsp;<span class="help">{{ trans('texts.payment_footer1') }}</span></h3>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
{!! Former::text('address1')->placeholder(trans('texts.address1'))->label('') !!} {!! Former::text('address1')
->autocomplete('address-line1')
->placeholder(trans('texts.address1'))
->label('') !!}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{!! Former::text('address2')->placeholder(trans('texts.address2'))->label('') !!} {!! Former::text('address2')
->autocomplete('address-line2')
->placeholder(trans('texts.address2'))
->label('') !!}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
{!! Former::text('city')->placeholder(trans('texts.city'))->label('') !!} {!! Former::text('city')
->autocomplete('address-level2')
->placeholder(trans('texts.city'))
->label('') !!}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{!! Former::text('state')->placeholder(trans('texts.state'))->label('') !!} {!! Former::text('state')
->autocomplete('address-level1')
->placeholder(trans('texts.state'))
->label('') !!}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
{!! Former::text('postal_code')->placeholder(trans('texts.postal_code'))->label('') !!} {!! Former::text('postal_code')
->autocomplete('postal-code')
->placeholder(trans('texts.postal_code'))
->label('') !!}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{!! Former::select('country_id')->placeholder(trans('texts.country_id'))->fromQuery($countries, 'name', 'id')->label('')->addGroupClass('country-select') !!} {!! Former::select('country_id')
->placeholder(trans('texts.country_id'))
->fromQuery($countries, 'name', 'id')
->addGroupClass('country-select')
->label('') !!}
</div> </div>
</div> </div>
@ -240,43 +270,53 @@ header h3 em {
<h3>{{ trans('texts.billing_method') }}</h3> <h3>{{ trans('texts.billing_method') }}</h3>
<div class="row"> <div class="row">
<div class="col-md-9"> <div class="col-md-9">
{!! Former::text('card_number')->placeholder(trans('texts.card_number'))->label('') !!} {!! Former::text('card_number')
->placeholder(trans('texts.card_number'))
->autocomplete('cc-number')
->label('') !!}
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
{!! Former::text('cvv')->placeholder(trans('texts.cvv'))->label('') !!} {!! Former::text('cvv')
->placeholder(trans('texts.cvv'))
->autocomplete('off')
->label('') !!}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
{!! Former::select('expiration_month')->placeholder(trans('texts.expiration_month')) {!! Former::select('expiration_month')
->addOption('01 - January', '1') ->autocomplete('cc-exp-month')
->addOption('02 - February', '2') ->placeholder(trans('texts.expiration_month'))
->addOption('03 - March', '3') ->addOption('01 - January', '1')
->addOption('04 - April', '4') ->addOption('02 - February', '2')
->addOption('05 - May', '5') ->addOption('03 - March', '3')
->addOption('06 - June', '6') ->addOption('04 - April', '4')
->addOption('07 - July', '7') ->addOption('05 - May', '5')
->addOption('08 - August', '8') ->addOption('06 - June', '6')
->addOption('09 - September', '9') ->addOption('07 - July', '7')
->addOption('10 - October', '10') ->addOption('08 - August', '8')
->addOption('11 - November', '11') ->addOption('09 - September', '9')
->addOption('12 - December', '12')->label('') ->addOption('10 - October', '10')
!!} ->addOption('11 - November', '11')
->addOption('12 - December', '12')->label('')
!!}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
{!! Former::select('expiration_year')->placeholder(trans('texts.expiration_year')) {!! Former::select('expiration_year')
->addOption('2015', '2015') ->autocomplete('cc-exp-year')
->addOption('2016', '2016') ->placeholder(trans('texts.expiration_year'))
->addOption('2017', '2017') ->addOption('2015', '2015')
->addOption('2018', '2018') ->addOption('2016', '2016')
->addOption('2019', '2019') ->addOption('2017', '2017')
->addOption('2020', '2020') ->addOption('2018', '2018')
->addOption('2021', '2021') ->addOption('2019', '2019')
->addOption('2022', '2022') ->addOption('2020', '2020')
->addOption('2023', '2023') ->addOption('2021', '2021')
->addOption('2024', '2024') ->addOption('2022', '2022')
->addOption('2025', '2025')->label('') ->addOption('2023', '2023')
!!} ->addOption('2024', '2024')
->addOption('2025', '2025')->label('')
!!}
</div> </div>
</div> </div>
@ -322,16 +362,6 @@ header h3 em {
</div> </div>
<!--
@if (isset($paymentTitle))
<h2>{{ $paymentTitle }}<br/>
@if (isset($paymentSubtitle))
<small>{{ $paymentSubtitle }}</small>
@endif
</h2>&nbsp;<p/>
@endif
-->
{!! Former::close() !!} {!! Former::close() !!}
<script type="text/javascript"> <script type="text/javascript">