Commit 04e32a24 authored by Khalid Ali's avatar Khalid Ali
Browse files

Start adjusting form

parent 2f7cf017
Pipeline #3776 passed with stages
in 3 minutes and 44 seconds
......@@ -2,17 +2,16 @@
<div>
<b-form @submit="onSubmit" @reset="onReset" v-if="show">
<b-form-group
id="exampleInputGroup1"
label="Email address:"
label-for="exampleInput1"
description="We'll never share your email with anyone else."
id="fieldset1"
label="ISBN:"
label-for="isbn"
>
<b-form-input
id="exampleInput1"
type="email"
v-model="form.email"
id="isbn"
type="number"
v-model="form.isbn"
required
placeholder="Enter email"
placeholder="Enter ISBN"
>
</b-form-input>
</b-form-group>
......@@ -49,13 +48,17 @@ import { Component, Vue } from 'vue-property-decorator';
@Component
export default class CreateListing extends Vue {
// Private Form Variables
private form: {email: string, name: string, food: object, checked: string[]} = {
email: '', name: '', food: {}, checked: [],
private form: {isbn: string, course: string, condition: object, photo: object,
accessCode: object, price: number, description: string} = {
isbn: '', course: '', condition: {}, photo: {}, accessCode: {}, price: 0, description: '',
};
private show: boolean = true;
// Food options
private foods: string[] = ['Select One', 'Carrots', 'Beans', 'Tomatoes', 'Corn'];
// List of options
private condition: string[] = ['Select One', 'New', 'Like New',
'Very Good', 'Good', 'Acceptable', 'Unacceptable'];
private accessCode: string[] = ['Not Applicable', 'Access Code Included',
'Access Code NOT Included'];
private onSubmit(evt: Event) {
evt.preventDefault();
......@@ -65,10 +68,13 @@ export default class CreateListing extends Vue {
private onReset(evt: Event) {
evt.preventDefault();
/* Reset our form values */
this.form.email = '';
this.form.name = '';
this.form.food = {};
this.form.checked = [];
this.form.isbn = '';
this.form.course = '';
this.form.condition = {};
this.form.photo = {};
this.form.accessCode = {};
this.form.price = 0;
this.form.description = '';
/* Trick to reset/clear native browser form validation state */
this.show = false;
this.$nextTick(() => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment