Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>backend/js/sweetalert2.css">
- <script src="<?php echo base_url(); ?>backend/js/sweetalert2.min.js"></script>
- <div class="main-section">
- <br /><br /><br />
- <div class="container" style="background-color: #fff; padding: 20px;margin-bottom: 100px;">
- <div class="col-md-6 no-padding">
- <h3 style="margin-left: 15px;">Daftar</h3>
- <form method="post" id="formInput" role="form">
- <div class="form-body">
- <div class="form-group col-md-12">
- <label class="control-label">Username</label>
- <input type="text" name="username" class="form-control" id="username" autocomplete="off" autofocus required>
- </div>
- <div class="form-group col-md-12">
- <label class="control-label">Nama Lengkap</label>
- <input type="text" name="name" class="form-control" autocomplete="off" required>
- </div>
- <div class="form-group col-md-6">
- <label class="control-label">Password</label>
- <input type="password" name="password" class="form-control" id="password" autocomplete="off" required>
- </div>
- <div class="form-group col-md-6">
- <label class="control-label">Konfirmasi Password</label>
- <input type="password" name="passwordconfirm" class="form-control" id="passwordconfirm" autocomplete="off" required>
- </div>
- <div class="form-group col-md-6">
- <label class="control-label">Email</label>
- <input type="text" name="email" class="form-control" id="email" autocomplete="off" required>
- </div>
- <div class="form-group col-md-6">
- <label class="control-label">Konfirmasi Email</label>
- <input type="text" name="emailconfirm" class="form-control" id="emailconfirm" autocomplete="off" required>
- </div>
- <!-- <div class="col-sm-6">
- <label><input type="checkbox" name="remember" id="remember"> Sigh up for our newsletter</label>
- </div>
- <div class="col-sm-6">
- <label><input type="checkbox" name="notifications" id="remember"> Send notifications to this email</label>
- </div> -->
- <div class="col-sm-12">
- <button type="submit" class="btn btn-primary">Daftar</button>
- <label>Punya Akun ? <a href="<?php echo site_url('login'); ?>">Login</a></label>
- </div>
- </div>
- </form>
- </div>
- <div class="col-md-6">
- <h3 class="">Terms and Conditions</h3>
- <p>By clicking on "Register" you agree to The Company's' Terms and Conditions</p>
- <p>While rare, prices are subject to change based on exchange rate fluctuations - should such a fluctuation happen, we may request an additional payment. You have the option to request a full refund or to pay the new price. (Paragraph 13.5.8)</p>
- <p>Should there be an error in the description or pricing of a product, we will provide you with a full refund (Paragraph 13.5.6)</p>
- <p>Acceptance of an order by us is dependent on our suppliers ability to provide the product. (Paragraph 13.5.6)</p>
- </div>
- </div>
- </div>
- <script type="text/javascript" src="<?php echo base_url(); ?>backend/assets/global/plugins/jquery-validation/js/jquery.validate.min.js"></script>
- <script type="text/javascript">
- $.validator.addMethod("alphanumeric", function(value, element) {
- return this.optional(element) || /^\w+$/i.test(value);
- }, "Hanya Huruf, Angka dan Garis Bawah");
- $(document).ready(function() {
- var form = $('#formInput');
- var error = $('.alert-danger', form);
- var success = $('.alert-success', form);
- $("#formInput").validate({
- errorElement: 'span',
- errorClass: 'help-block help-block-error',
- focusInvalid: false,
- ignore: "",
- rules: {
- username: {
- required: true, minlength: 5, alphanumeric: true,
- remote: {
- url: "<?php echo site_url('register/register_user_exists'); ?>",
- type: "post",
- data: {
- username: function() {
- return $("#username").val();
- }
- }
- }
- },
- name: {
- required: true,
- minlength: 5
- },
- password: {
- required: true,
- minlength: 5
- },
- passwordconfirm: {
- required: true,
- minlength: 5,
- equalTo: "#password"
- },
- email: {
- required: true,
- email: true,
- remote: {
- url: "<?php echo site_url('register/register_email_exists'); ?>",
- type: "post",
- data: {
- email: function() {
- return $("#email").val();
- }
- }
- }
- },
- emailconfirm: {
- required: true,
- email: true,
- equalTo: "#email"
- }
- },
- messages: {
- username: {
- required:'Username harus diisi',
- minlength:'Minimal 5 Karakter',
- remote: 'Username ini sudah Ada'
- },
- name: {
- required:'Nama Lengkap harus diisi',
- minlength:'Minimal 5 Karakter'
- },
- password: {
- required:'Password harus diisi',
- minlength:'Minimal 5 Karakter'
- },
- passwordconfirm: {
- required:'Konfirmasi Password harus diisi',
- minlength:'Minimal 5 Karakter',
- equalTo:'Konfirmasi Password tidak sama.'
- },
- email: {
- required:'Email harus diisi',
- email:'Email tidak Valid',
- remote: 'Email ini sudah Terdaftar'
- },
- emailconfirm: {
- required:'Konfirmasi Email harus diisi',
- email:'Email tidak Valid',
- equalTo:'Konfirmasi Email tidak sama.'
- }
- },
- invalidHandler: function (event, validator) {
- success.hide();
- error.show();
- // Metronic.scrollTo(error1, -200);
- },
- highlight: function (element) {
- $(element)
- .closest('.form-group').addClass('has-error');
- },
- unhighlight: function (element) {
- $(element)
- .closest('.form-group').removeClass('has-error');
- },
- success: function (label) {
- label
- .closest('.form-group').removeClass('has-error');
- },
- submitHandler: function(form) {
- dataString = $("#formInput").serialize();
- $.ajax({
- url: "<?php echo site_url('register/savedata'); ?>",
- type: "POST",
- data: dataString,
- success: function(data) {
- setTimeout(function() {
- swal({
- title:"Sukses",
- text: "Pendaftaran Anda Berhasil",
- timer: 2000,
- showConfirmButton: false,
- type: "success"
- })
- });
- },
- error: function() {
- setTimeout(function() {
- swal({
- title:"Error",
- text: "Pendaftaran Anda Gagal",
- timer: 2000,
- showConfirmButton: false,
- type: "error"
- })
- });
- }
- });
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement