Uploaded image for project: 'HTML Form Entry Module'
  1. HTML Form Entry Module
  2. HTML-558

Referring to jQuery as $j does not work in the new UI

    Details

    • Type: Bug
    • Status: Ready for Work
    • Priority: Should
    • Resolution: Unresolved
    • Affects Version/s: HTML Form Entry 2.4
    • Fix Version/s: None
    • Labels:
      None
    • Complexity:
      Undetermined

      Description

      The following don't work; neither section of JavaScript...

      <htmlform formUuid="62da3b0c-1980-470f-b936-ccc883abf722" formName="Postnatal" formEncounterType="abe6fe49-8edf-4f06-944f-f1988e08343c" formVersion="1.0">
      
      <ifMode mode="ENTER">
      <includeIf velocityTest="!($patient.gender == 'F') || (! $patient.age) || ($patient.getAge($encounter.getEncounterDatetime()) &lt; 13) ||($patient.getAge($encounter.getEncounterDatetime()) > 60)">
         <script type="text/javascript">
             $j(function() {
                    window.onload = function() {      
                    window.alert("Erè: Pasyan an pa gen sèks li, dat nesans li oubyen li two jen pou antre nan sistèm nan.  Tanpri verifye ke pasyan an gen sèks ak dat de nesans e fok li gen plis ke 13 an avan ou ranpli fòm nan.\nERROR: Unknown gender or date of birth or patient to young.  Please verify the patient has gender and birthdate and is more than 13 years old before filling out this form.")
                 window.history.back()
                 } 
              });
         </script>
      </includeIf>
      <includeIf velocityTest="$patient.getAge($encounter.getEncounterDatetime()) &lt; 17  || $patient.getAge($encounter.getEncounterDatetime()) > 50">
         <script type="text/javascript">
            $j(function() {
                window.onload = function() {
                window.alert('Li pa pwobab ke pasyan sa a ansent.  Tanpri verifye ke dat nesans lan vrè, e se pasyan sa a ki ansent lan.\nIt is unlikely that this patient is pregnant.  Please verify their birthdate is correct, and that it is this patient that is pregnant.')
                 } 
            });
          </script>
      </includeIf>
      </ifMode>
      

      This does work...

      <script type="text/javascript">
      <!-- Error Checking before Form Submit -->
      beforeSubmit.push(function() {
          var error = false;
          <!-- Clear the previous errors -->
          setValue('deliverydate.error', '');
         
          <!-- For delivery date not within the past year  -->
          var deliveryDate = getValue('deliverydate.value');
          deliveryDate = deliveryDate.replace(/-/g,'/')
          if ( Math.abs(new Date() - new Date(deliveryDate)) > 31536000000 ) { // 1 year in milliseconds
              getField('deliverydate.error').html('Dat akouchman an pa sipoze depase 1 an, anvan jodi a.\nThe delivery date must be within the past year.').show();
              error = true;
          }
      
          <!-- For delivery date less than 9 months since last delivery date  -->
          var deliveryDate = getValue('deliverydate.value');
          deliveryDate = deliveryDate.replace(/-/g,'/')
          lastDelivery = window.lastDelivery.replace(/-/g,'/')
          if ( Math.abs(new Date(deliveryDate) - new Date(lastDelivery))  &lt; 23500800000 ) { // 9-months in milliseconds
              getField('deliverydate.error').html('Dat akouchman an oblije plis ke 9 mwa apre denye akouchman; denye akouchman se te '+lastDelivery+'.\nThe delivery date must be at least 9 months since prior delivery.  The last delivery was '+lastDelivery+'.').show();
              error = true;
          }
      
          if (error == true) {
                return false;
          }
          return true;
      });
      </script>
      

      Both are in the same form, and both work when using the legacy UI. In the new UI, it doesn't make any difference between standard or simple.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                arbaughj James Arbaugh
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: