How can we use the datepicker to change the date format with vee-validate V4 library - date

Currently I am using the vee-validate v4 library to validate all my form inputs, How can I use the datepicker with vee-validate to change the date format ? I am using schema format to validate the fields like :validation-schema="schema" And I have to change the date format to be mm/dd/yyyy
<Form class="row g-3" :validation-schema="schema" #submit="submit($event)" v-slot="{ errors }">
<div class="col-md-6">
<label for="inputdate" class="form-label"
>Expiration Date<span class="required-field"></span></label>
<Field
name="ExpiryDate"
type="date"
v-model="ExpiryDate"
placeholder="Enter date"
class="form-control"
id="inputdate"
:class="{ 'is-invalid': errors.ExpiryDate }"
/>
<div class="invalid-feedback">
{{ errors.ExpiryDate }}
</div>
</div>
</Form>

There is no direct way to achieve the validation of datepicker through vee-validate, you will have to handle it manually through code.

Related

Autocomplete credit card expiry cc-exp not filling in the desired format

I've recently discovered that my credit card expiry date is not being populated by the browser autocomplete even though Name and Card number populate fine. The field does highlight as if it wants fill, it just doesn't get a value.
I have looked at other sites with working forms for differences and found that changing the expiry date to type="tel" allows it to be filled, but the format is MM/YYYY. I can add maxlength="5" to change the format to MM/YY but I want the format to be MMYY without the slash. A maxlength="4" fails to fill.
Here's my code without any of the noted workarounds. I don't feel that tel is the appropriate input type but it's good to give a numerical keyboard on mobile devices when the input is only numbers.
Please can you share your wisdom on ways to autofill the credit card expiry date in a MMYY format without a slash separator?
.standardControl {
margin-bottom: 10px;
}
.standardControl label {
display: block;
}
<form action="" method="post">
<div class="standardControl">
<label for="Name">Name on card</label>
<input type="text" class="text" id="Name" name="Name" value="">
</div>
<div class="standardControl">
<label for="CardNumber">Card number</label>
<input type="number" class="number" id="CardNumber" name="CardNumber"
autocomplete="cc-number">
</div>
<div class="standardControl">
<label for="ExpiryDate">Expiry date
<span class="additionLabel">(MMYY)</span></label>
<input type="number" class="number" id="ExpiryDate" name="ExpiryDate"
autocomplete="cc-exp" placeholder="MMYY" value="">
</div>
<div class="standardControl">
<label for="securityCode">Security code</label>
<input type="number" class="number" id="securityCode" name="securityCode">
</div>
</form>

In Chart js how to get date selector

How to get date picker in chart.js chart to get historical data with in the selected range of date from the client side.
If I give a query in the backend it gives a chart but if I give from client side i.e. from front end it doesn't send the chart. It replies with the JSON data for selected dates
Chart.js has no plugin for a datetimepicker. I recommend you the eonasdan datetimepicker. For an interval two pickers are needed. After a succesful implementation of these you need a form for the userinputs (client side) to $_POST or $_GET inputs to your server side. You need to refer the used librarys in the header of your HTML-Doc.
HTML
(optional you can add some bootstrap-glyphicons):
<form id="dates" method="post">
<div class="form-group">
<div class='input-group date' id='startinterval'>
<input id="start" type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="form-group">
<div class='input-group date' id='endinterval'>
<input id="end" type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</form>
JavaScript
create a new JS-file and use jQuery and EONASDAN
$( document ).ready(function() {
$('#startinerval').datetimepicker({
//specify your datetimepicker
});
$('#endinterval').datetimepicker({
//specify your datetimepicker
});
});
I guess you query a database to get the chartdata. So you need to query your database in dependence to the userinputs of the datepickers. Afterwards, store the resulting data in an array and convert them to a JSON:
$data = array('xaxis' => $xaxis, 'yaxis' => $yaxis);
json_encode($data);
Keep in mind that this code is only an example and needed to embed in your own code!!!
Do you use Ajax for server/client communication?

Angular 2 custom formGroup component

i've been searching for this and couldn't find any answers specific for my need:
I have a really big form, which i want to slice in components. My form looks like this:
<form #form="ngForm" (ngSubmit)="onSubmit(form)">
<div ngModelGroup="someInfo">
<input type="text" ngModel>
<input type="text" ngModel>
</div>
<div ngModelGroup="someOtherInfo">
<input type="text" ngModel>
<select ngModel>SomeOptions</select>
</div>
</form
I want to create separate components for these groups so when i check form.value it sees the groups, something like this:
<form #form="ngForm" (ngSubmit)="onSubmit(form)">
<some-info-component ngModelGroup="someInfo"></some-info-component>
<some-other-info-component ngModelGroup="someOtherInfo"></some-other-info-component>
</form>
so how do i make this work, when i try to access form.value.someInfo it is empty object, i've tried with ControlValueAccessor but it only works when i give these components [ngModel] but not with ngModelGroup

Aligning inputs on bootstrap using the Fluid Grid System

I am creating a form that requires the user to input their name and email address. The first line of the form has two inputs side by side for each part of the name and the 2nd line has one input for the email address that should be the same width as the first line combined. I'm trying to use the fluid grid system but can't line up the 2nd row with the first.
<form action="/subscriptions" method="post">
<fieldset>
<div class="control-group">
<label class="control-label" for="name">Name</label>
<div class="controls row-fluid">
<input class="span2" id="first_name" name="first_name" placeholder="First" required="required" type="text">
<input class="span2" id="last_name" name="last_name" placeholder="Last" required="required" type="text">
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">Email</label>
<div class="controls row-fluid">
<input class="span4" id="email" name="email" type="email">
</div>
</div>
</fieldset>
</form>​
http://jsfiddle.net/sguha095/v4amX/
Have a look a this jdfiddle: http://jsfiddle.net/kY5LL/18/
I added some div.row-fluid containers per row of your form and one extra set of inputs for demonstration.
Hope this is what you were looking for.
First we need to clean up the HTML a bit, there is an extra closing div on the first line.
I just added some classes to improve the styling so you could see how it works. The input-block-level class is a bootstrap mixin to force inputs to act like true block level elements. That's needed if you want this to be clean and to leverage the benefits of CSS. If you want to do all of your styling with HTML, then you can do so with more markup and less semantic methods, but I would recommend against it.
Hope this helps!
http://jsfiddle.net/kY5LL/12/

Creating html elements in zend forms

I will like to translate this full code into a zend form with all the ids, html image elements, the classes, the spans. Everything. Am finding it difficult to add the image and to group the elements accordint to the divs and spans.
I will be grateful if anyone could help me. Thank you.
<form method="get" action="/search" name="searchForm" id="searchForm">
<div class="logo">
<a href="http://trial.com" title="Trial" name="trialLogo">
<img width="205" height="40" alt="Trial Search" src="..image/logo.png">
</a>
</div>
<input type="hidden" value="/Listing" name="ref_uri">
<div class="inputBlock">
<span class="inputWrapper"><input type="text" class="labelMagic fieldHelpText" tabindex="3" id="what" name="what" autocomplete="off"><input type="hidden" name="listingId"></span>
</div>
<div class="inputBlock">
<span class="inputWrapper"><input type="text" autocomplete="off" value="Location" class="labelMagic" tabindex="4" id="where" name="where"><input type="hidden" name="geoId"></span>
</div>
<div class="submitWrapper"><button class="goButton" tabindex="5" name="go" type="submit">Go!</button>
</div>
</form>
You could certainly employ a collection of configured HtmlTag decorators to perform all this wrapping, including setting the attributes on all these divs and spans.
But perhaps easier would be to simply employ a ViewScript decorator for the form. A good example appears on this MWOP Dev Zone article.