Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions qp-template-master/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions qp-template-master/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"bootstrap": "^4.5.0",
"font-awesome": "^4.7.0",
"katex": "^0.11.1",
"popups": "^1.1.3",
"react": "^16.13.1",
Expand Down
10 changes: 10 additions & 0 deletions qp-template-master/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
border-color: white;
}

.preview{
padding-left: 30px;
}

.button{
background-color: violet;
}



.row-align{
justify-content: center;
}
Expand Down
28 changes: 21 additions & 7 deletions qp-template-master/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,34 @@ class template extends Component {
super();
this.state={
date:'',
rollno:'',
subject:'',
semester:'',
course:'',
regulation:'',
time:'',
marks:'',
touched:[
touched:
{
date:false,
rollno:false,
subject:false,
semester:false,
course:false,
regulation:false,
time:false,
marks:false,
}
]


}
this.handleBlur=this.handleBlur.bind(this)
}

validate(date,subject,semester,course,regulation,time,marks){
validate(date,rollno,subject,semester,course,regulation,time,marks){
const errors={
date:'',
rollno:'',
subject:'',
semester:'',
course:'',
Expand All @@ -47,6 +50,9 @@ class template extends Component {
if(this.state.touched.date&&date=='')
errors.date="Date should not be empty";

if(this.state.touched.rollno&&rollno=='')
errors.rollno="Rollno should not be empty";

if(this.state.touched.subject&&subject=='')
errors.subject="Subject should not be empty";

Expand Down Expand Up @@ -84,21 +90,29 @@ class template extends Component {

render(){

const errors=this.validate(this.state.date,this.state.subject,this.state.semester,this.state.course,this.state.regulation,this.state.time,this.state.marks)
const errors=this.validate(this.state.date,this.state.rollno,this.state.subject,this.state.semester,this.state.course,this.state.regulation,this.state.time,this.state.marks)
return(
<Container>


<Form onSubmit={this.handleSubmit} onChange={this.handleChange}>
<Row className="form-group row-align">
<Col md={3} className=" offset-md-9">
<Row className="form-group">
<Col md={3}>
<Input type="date" className="form-control" style={{textAlign:'center'}} onChange={this.handleChange}
onBlur={this.handleBlur('date')}

invalid={errors.date!==''}
id="date" name="date" placeholder="Date"/>
<FormFeedback>{errors.date}</FormFeedback>
</Col>
<Col md={3} className="offset-md-6">
<Input type="rollno" className="form-control" style={{textAlign:'center'}} onChange={this.handleChange}
onBlur={this.handleBlur('rollno')}

invalid={errors.rollno!==''}
id="rollno" name="rollno" placeholder="Rollno"/>
<FormFeedback>{errors.rollno}</FormFeedback>
</Col>

</Row>
<Row className="form-group row-align">
Expand Down
Loading