Home Forums Porto Admin Template Form Validation on Date Fields

This topic contains 2 replies, has 2 voices, and was last updated by  dsteel 2 days, 14 hours ago. This post has been viewed 35 times

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10028511

    dsteel
    Participant

    How do I apply validation date on date fields, please?

    I want to ensure that a valid date is entered and the field not left empty.

    Thanks

    David


    #10028528

    Support
    Keymaster

    Hello, here’s a simple way to validate:

    <form id="form" action="forms-validation.html" class="form-horizontal">
    	<section class="card">
    		<header class="card-header">
    			<div class="card-actions">
    				<a href="#" class="card-action card-action-toggle" data-card-toggle></a>
    				<a href="#" class="card-action card-action-dismiss" data-card-dismiss></a>
    			</div>
    
    			<h2 class="card-title">Basic Form Validation</h2>
    			<p class="card-subtitle">
    				Basic validation will display a label with the error after the form control.
    			</p>
    		</header>
    		<div class="card-body">
    			<div class="form-group row">
    				<label class="col-sm-3 control-label text-sm-right pt-2">Date <span class="required">*</span></label>
    				<div class="col-sm-9">
    					<input class="form-control" id="eventDate" name="event_date" placeholder="MM/DD/YYYY" type="text" required>
    				</div>
    			</div>
    		</div>
    		<footer class="card-footer">
    			<div class="row justify-content-end">
    				<div class="col-sm-9">
    					<button class="btn btn-primary">Submit</button>
    					<button type="reset" class="btn btn-default">Reset</button>
    				</div>
    			</div>
    		</footer>
    	</section>
    </form>

    If you want to add input mask, please check our examples:
    https://preview.oklerthemes.com/porto-admin/2.1.1/forms-advanced.html

    Kind Regards,

    Jonas


    #10028626

    dsteel
    Participant

    I now have this working.

    Thanks

    David


Viewing 3 posts - 1 through 3 (of 3 total)