File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ async function setPatientList() {
4747 const cellUsername = row . insertCell ( - 1 ) ;
4848 cellUsername . innerHTML = patient . username ;
4949 for ( const field of fields ) {
50- console . log ( '## field' , field ) ;
51- row . insertCell ( - 1 ) . innerHTML = patient . formData [ field . dataFieldKey ] ?. value || '' ;
50+ const value = patient . formData [ field . dataFieldKey ] ?. value ;
51+ row . insertCell ( - 1 ) . innerHTML = ( value != null ) ? value : '' ;
5252 }
5353 }
5454}
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ async function getPatientsList () {
6666 patient . username = patientInfo . user . username ;
6767
6868 // -- get data
69- const profileEvents = await patientConnection . api ( [ { method : 'events.get' , params : { streams : [ 'profile' ] } } ] ) ;
69+ const profileEvents = await patientConnection . api ( [ { method : 'events.get' , params : { limit : 100 } } ] ) ;
7070 for ( const profileEvent of profileEvents [ 0 ] . events ) {
7171 const field = dataFieldFromEvent ( profileEvent ) ;
7272 if ( field ) {
Original file line number Diff line number Diff line change @@ -19,12 +19,16 @@ <h1>Demo Form</h1>
1919 < table width ="100% ">
2020 < td >
2121 < div class ="card-body ">
22- < h3 > < A HREF ="dr.html "> Dr's Page</ A > </ h3 >
22+ < h2 > < A class ="card-title " HREF ="dr.html "> Dr's Page</ A > </ h2 >
23+ From this page you will be able to visualize the data from patients and share an invitation link to fill your questionnaire.< BR >
2324 </ div >
2425 </ td >
2526 < td >
2627 < div class ="card-body ">
27- < h3 > < A HREF ="patient.html "> Patient's Page</ A > </ h3 >
28+ <!--
29+ <h2><A class="card-title" HREF="patient.html">Patient's Page</A></h2>
30+ From this page you will be able to visualize your current data and forms you particpated in.<BR>
31+ -->
2832 </ div >
2933 </ td >
3034 </ table >
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ async function updateFormContent() {
4848 for ( let i = 0 ; i < formData . length ; i ++ ) {
4949 const formField = formData [ i ] ;
5050 const fieldId = formField . id ;
51- const fieldValue = formField . value || '' ;
51+ const fieldValue = ( formField . value != null ) ? formField . value : '' ;
5252 const fieldType = formField . type ;
5353 const fieldLabel = formField . label ;
5454
Original file line number Diff line number Diff line change @@ -159,9 +159,17 @@ async function getFormContent () {
159159
160160// ---------------- create / update data ---------------- //
161161
162- async function parseValue ( value , type ) {
162+ function parseValue ( value , type ) {
163+ if ( value === undefined || value === null || value === '' ) {
164+ return '' ;
165+ }
163166 if ( type === 'number' ) {
164- return parseFloat ( value ) ;
167+ const parsedValue = parseFloat ( value ) ;
168+ if ( isNaN ( parsedValue ) ) {
169+ console . error ( '## Error parsing number' , value ) ;
170+ return '' ;
171+ }
172+ return parsedValue ;
165173 }
166174 if ( type === 'boolean' ) {
167175 return value === 'true' ;
@@ -175,8 +183,7 @@ async function handleFormSubmit (values) {
175183 const streamId = field . streamId ;
176184 const eventType = field . eventType ;
177185 const eventId = field . eventId ;
178- const value = values [ field . id ] ;
179- console . log ( '## Value' , field . id , value ) ;
186+ const value = parseValue ( values [ field . id ] , field . type ) ;
180187 if ( value === '' && eventId ) {
181188 // delete the event
182189 apiCalls . push ( {
You can’t perform that action at this time.
0 commit comments