Page tree
Skip to end of metadata
Go to start of metadata
  1.  Future Date Validation

    This is a function to validate that date entered is a future date. It will show an error message if the date provided is a current or prior date. Uses class future-date and has to be a date or datetime field.

    //datepicker with future date validation
    <input class="form-control datepicker future-date" id="encounter.encounter_datetime" name="encounter.encounter_datetime"
     type="text" readonly="readonly" required="required">
    
    or
    
    //datetimepicker with future date validation
    //must include css/bootstrap-datetimepicker.min.css and js/bootstrap-datetimepicker.min.js in order for this to work
    <input class="form-control datetimepicker future-date" id="encounter.encounter_datetime" name="encounter.encounter_datetime"
     type="text" readonly="readonly" required="required">
    
    
  2. Past Date validation
    This is used to ensure that the date provided is a prior/past date. It will show an error message if the date provided is a future date.

    //datepicker with future date validation
    <input class="form-control datepicker past-date" id="encounter.encounter_datetime" name="encounter.encounter_datetime"
     type="text" readonly="readonly" required="required">
    
    or
    
    //datetimepicker with past date validation
    //must include css/bootstrap-datetimepicker.min.css and js/bootstrap-datetimepicker.min.js in order for this to work
    <input class="form-control datetimepicker past-date" id="encounter.encounter_datetime" name="encounter.encounter_datetime"
     type="text" readonly="readonly" required="required">
  3.  Date Picker
    Used to insert a date picker to a form field. The field should be read-only to ensure that users don't have the ability to type the date but pick from the date picker.

    <input class="form-control datepicker" id="encounter.encounter_datetime" name="encounter.encounter_datetime"
     type="text" readonly="readonly" required="required">
  4.  Date Time Picker
    Used to insert a DateTime picker i.e date picker with a time component

    //must include css/bootstrap-datetimepicker.min.css and js/bootstrap-datetimepicker.min.js in order for this to work
    <input class="form-control datetimepicker" id="encounter.encounter_datetime" name="encounter.encounter_datetime"
     type="text" readonly="readonly" required="required">
  5.  Luhn Mode check Validation
    This is a luhn mode check-digit validation. It Accepts numbers(0-9), alphabet(A-Z) and underscore (_) i.e 0123456789ABCDEFGHIJKLMNOPQRSTUVYWXZ_. It does calculation using the check-digit algorithm and shows an error message if the value is not a valid check-digit number
    Uses class check digit.

    <input class="form-control checkDigit" id="" name="patient.identifier" type="text" required="required">


  6.  Non-Future date validation

    Used to validate for a non-future date i.e date should be the current date or previous date. Uses class nonFutureDate

    //datepicker with non-future date validation
    <input class="form-control datepicker nonFutureDate" id="encounter.encounter_datetime" 
    name="encounter.encounter_datetime" type="text" readonly="readonly" required="required">
    
    or
    
    //datetimepicker with non-future date validation
    //must include css/bootstrap-datetimepicker.min.css and js/bootstrap-datetimepicker.min.js in order for this to work
    <input class="form-control datetimepicker nonFutureDate" id="encounter.encounter_datetime" 
    name="encounter.encounter_datetime" type="text" readonly="readonly" required="required">
  7.  Future date validation

    Checks if the date provided is a future date. Will show error message if the date provided is the current date or previous date. Uses class checkFutureDate

    //datepicker with non-future date validation
    <input class="form-control datepicker checkFutureDate" id="encounter.encounter_datetime" name="encounter.encounter_datetime" 
    type="text" readonly="readonly" required="required">
    
    or
    
    //datetimepicker with non-future date validation
    //must include css/bootstrap-datetimepicker.min.css and js/bootstrap-datetimepicker.min.js in order for this to work
    <input class="form-control datetimepicker checkFutureDate" id="encounter.encounter_datetime" 
    name="encounter.encounter_datetime" type="text" readonly="readonly"
    required="required">
  8.  Phone Number Validation
    Checks if the number provided is numeric and has a length of between 8 and 12. Uses class phoneNumber

    <input class="form-control datepicker phoneNumber" id="" name="" type="text" required="required">
  9. Initial Form opening Timestamp logging
    This class is used to audit at what specific time a form was initially opened for data entry. It can as well be used together with 10 below to determine the time it takes to complete data entry for a form.  Uses Class initialFormOpeningTimestamp

    <input class="form-control initialFormOpeningTimestamp" id="" name="" type="text" readonly="readonly">


  10.  Data entry completion timestamp logging    

    Automatically captures the saving timestamp a form when it is saved as complete. It can be used together with 9 above to determine the time it takes to complete data entry for a specific form. Uses class dataEntryCompletionTimeStamp

    <input class="form-control dataEntryCompletionTimeStamp" id="" name="" type="text" readonly="readonly">
  11.  GPS logging for data entry

    Automatically captures the GPS location of the user during initial form opening and subsequent form reopening and saving. Uses class cumulativeDataEntryGPSData.

    <input class="form-control cumulativeDataEntryGPSData" id="" name="" type="text" readonly="readonly">
    
    
    
    
  12. Country auto-complete.

This function is used to enable a field to have an autocomplete of countries. Uses function setupAutoCompleteForCountry(fieldName) where fieldName is the name of the field to which the autocomplete is attached.


<input type="text" class="form-control" data-concept="162604^Country visited^99DCT" name="obs.internatinal_travel_countries" id="obs.internatinal_travel_countries" required="required">
//then this 
document.setupAutoCompleteForCountry("obs\\.internatinal_travel_countries");

  13. Launching a form from an open form 


This function will be used to launch an encounter form from an already opened form when a certain condition/answer is given eg if an answer to a question is yes. Uses function launchEncounterMiniForm(patientUuid,formUuid)

//in js second parameter being the uuid of the form to be opened
document.launchEncounterMiniForm( $("#patient\\.uuid").val(),"55de3229-4f10-4c8b-9620-c6be405bb043"); 

     14. Calculating the date of birth given age in years and months

This function will be used to calculate the date of birth give age in years and months.Uses function getTempBirthDateFromYearsAndMonths(tempAgeInYears,tempAgeInMonths) 

//in javascript
$.fn.getTempBirthDateFromYearsAndMonths(50,10) 

15. Launching a map from a form

This class will be used to launch a map from a form. That is loading a map with the ability to pick/select location to be set as part of the address of the patient. uses class .gps-location-picker

//data-create-demographics-update set to true will generate demographic update payload that will be processed at server side to incorporate GPS address.							
<div class="form-group" id="pick-gps-button-div">
	<button onclick="return false" class="form-control btn btn-primary gps-location-picker"
			data-zoomlevel="9" data-create-demographics-update="true">Pick GPS address</button>
</div>

//to fill latitude field
//NB: field must have class latitude
<div class="form-group gps-details">
	<label for="latitude">Latitude: <span class="required">*</span> </label>
	<input class="form-control latitude" id="latitude" name="latitude"
		   required="required" type="text" readonly="readonly">
</div>

//to fill longitude field
//NB: field must have class longitude
<div class="form-group gps-details">
	<label for="longitude">Longitude: <span class="required">*</span></label>
	<input class="form-control longitude" id="longitude" name="longitude"
		   required="required" type="text" readonly="readonly">
</div>

            

  • No labels