@@ -19,7 +19,7 @@ class Apply extends React.Component {
1919 processStep : 1 ,
2020 formValidated : false ,
2121 error : null ,
22- processing : false
22+ processing : false ,
2323 } ;
2424 }
2525
@@ -73,15 +73,30 @@ class Apply extends React.Component {
7373 < Card . Body >
7474 < Form . Group controlId = "name" >
7575 < Form . Label > Hello, my name is:</ Form . Label >
76- < Form . Control type = "text" required defaultValue = { name } pattern = "[A-Za-z0-9 ]{3,50}" data-error = "Please enter" />
77- < Form . Control . Feedback type = "invalid" > Your name needs to be between 3 and 50 characters long.</ Form . Control . Feedback >
76+ < Form . Control
77+ type = "text"
78+ required
79+ defaultValue = { name }
80+ pattern = "[A-Za-z0-9 ]{3,50}"
81+ data-error = "Please enter"
82+ />
83+ < Form . Control . Feedback type = "invalid" >
84+ Your name needs to be between 3 and 50 characters long.
85+ </ Form . Control . Feedback >
7886 < Form . Text className = "text-muted" > Your name will be anonymous except to your match</ Form . Text >
7987 </ Form . Group >
8088
8189 < Form . Group controlId = "oneLineIntro" >
8290 < Form . Label > One-line intro of yourself:</ Form . Label >
83- < Form . Control type = "text" required defaultValue = { oneLineIntro } pattern = "[A-Za-z0-9,!?\x27\x22\s\.]{8,140}" />
84- < Form . Control . Feedback type = "invalid" > Please share an intro between 8 and 140 characters long.</ Form . Control . Feedback >
91+ < Form . Control
92+ type = "text"
93+ required
94+ defaultValue = { oneLineIntro }
95+ pattern = "[A-Za-z0-9,!?\x27\x22\s\.]{8,140}"
96+ />
97+ < Form . Control . Feedback type = "invalid" >
98+ Please share an intro between 8 and 140 characters long.
99+ </ Form . Control . Feedback >
85100 </ Form . Group >
86101
87102 < Form . Group controlId = "lookingFor" >
@@ -106,7 +121,7 @@ class Apply extends React.Component {
106121
107122 getForm3 ( ) {
108123 const { email, timezone } = this . _formData || { } ;
109- const { formValidated, processing } = this . state ;
124+ const { formValidated, processing } = this . state ;
110125 return (
111126 < Form noValidate validated = { formValidated } onSubmit = { this . handleSubmit } >
112127 < Card >
@@ -157,18 +172,17 @@ class Apply extends React.Component {
157172 if ( this . state . processStep === 3 ) {
158173 // TODO submit the form to backend
159174 const data = this . _formData ;
160- this . setState ( { ' processing' : true } ) ;
161- Meteor . call ( " users.enroll" , data , ( error , result ) => {
175+ this . setState ( { processing : true } ) ;
176+ Meteor . call ( ' users.enroll' , data , ( error , result ) => {
162177 if ( error ) {
163- this . setState ( { ' error' : error . reason } ) ;
164- this . setState ( { ' processing' : false } ) ;
178+ this . setState ( { error : error . reason } ) ;
179+ this . setState ( { processing : false } ) ;
165180 }
166181 if ( result ) {
167- this . setState ( { ' processing' : false } ) ;
168- this . props . history . push ( '/woohoo' )
182+ this . setState ( { processing : false } ) ;
183+ this . props . history . push ( '/woohoo' ) ;
169184 }
170185 } ) ;
171-
172186 } else {
173187 // Move to next form
174188 this . setState ( state => ( { formValidated : false , processStep : state . processStep + 1 } ) ) ;
0 commit comments