- Messages
- 46
- Reaction score
- 1
- Points
- 28
Tanong ko lang po? Bakit ang form ko di gumagana ang submit button once na gumamit ang ng form validation ng bootstrap template ko? dba pag usual na code lang
yung "process/user-add.php" yan po yung separated file ko para sa process ng pag insert.
YAN po yung code ko sa form.. then ito naman SCRIPT
yung "process/user-add.php" yan po yung separated file ko para sa process ng pag insert.
Code:
<div class="modal-body">
<form method="post" action="process/user-add.php" id="validate" >
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-5">
<div class="form-group">
<label class="control-label">User name
<span class="required">*</span>
</label>
<input class="form-control" type="text" name="user_name" placeholder="User name" required>
</div>
<div class="form-group">
<label class="control-label">Password
<span class="required">*</span>
</label>
<input class="form-control" type="password" name="password" placeholder="Password" required>
</div>
<div class="form-group">
<label class="control-label">First name
<span class="required">*</span>
</label>
<input class="form-control" type="text" name="first_name" placeholder="First name" required>
</div>
<div class="form-group">
<label class="control-label">Last name
<span class="required">*</span>
</label>
<input class="form-control" type="text" name="last_name" placeholder="Last name" required>
</div>
<div class="form-group">
<label class="control-label">E-mail
<span class="required">*</span>
</label>
<input class="form-control" type="email" name="email" placeholder="E-mail" required>
</div>
</div>
<div class="col-lg-5">
<div class="form-group">
<label class="control-label">Gender
<span class="required">*</span>
</label><br>
<input type="radio" name="gender"checked="checked" value="Male"> Male
<input type="radio" name="gender" value="Female"> Female
</div>
<div class="form-group">
<label class="control-label">Birthday
<span class="required">*</span>
</label>
<input class="form-control" type="date" name="birthday" placeholder="YYYY-MM-DD" required>
</div>
<div class="form-group">
<label class="control-label">Address
<span class="required">*</span>
</label>
<textarea name="address" class="form-control" COLS=40 ROWS=6 placeholder="Address" required></textarea>
</div>
</div>
<div class="col-lg-1"></div>
</div>
</div>
<div class="modal-footer">
<button type="submit" id="submit" name="submit" class="btn btn-success"><i class="fa fa-plus"></i> Add</button>
</form>
YAN po yung code ko sa form.. then ito naman SCRIPT
Code:
<script>
$(document).ready(function($) {
Site.run();
$('#submit').click(function(){
});
// Example Validataion Standard Mode
// ---------------------------------
(function() {
$('#validate').formValidation({
framework: "bootstrap",
fields: {
user_name: {
validators: {
notEmpty: {
message: 'The username is required'
},
stringLength: {
min: 6
},
regexp: {
regexp: /^[a-zA-Z0-9]+$/
}
}
},
password: {
validators: {
notEmpty: {
message: 'The password is required and cannot be empty'
},
stringLength: {
min: 8
}
}
},
first_name: {
validators: {
notEmpty: {
message: 'The full name is required and cannot be empty'
},
regexp: {
regexp: /^[a-zA-Z]+$/
}
}
},
last_name: {
validators: {
notEmpty: {
message: 'The last name is required and cannot be empty'
},
regexp: {
regexp: /^[a-zA-Z]+$/
}
}
},
email: {
validators: {
notEmpty: {
message: 'The email address is required and cannot be empty'
},
emailAddress: {
message: 'The email address is not valid'
}
}
},
gender: {
validators: {
notEmpty: {
message: 'The gender is required and cannot be empty'
}
}
},
birthday: {
validators: {
notEmpty: {
message: 'The birthdate is required and cannot be empty'
},
regexp: {
regexp: /^[0-9-]+$/
}
}
},
address: {
validators: {
notEmpty: {
message: 'The andress is required and cannot be empty'
},
stringLength: {
max: 50,
message: 'The address must be less than 50 characters long'
}
}
}
}
});
})();
});
</script>