Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: simplified java documentation examples

...

  • argument: idAndProperty the field you want to get (for example "weight.value")
  • returns: a JQuery selector for the field you requested
    Example for obs (since: 1.6.8):
    Code Block
    $j(function() {
    getField('weight.value').change(function() {
             window.alert('Weight is now ' + getValue('weight.value'))
        });
    });
    
    Example for encounter details (since: 1.9.1):
    Code Block
    $j(function() {
             getField('encounterDate.value').change(function() {
             window.alert('Encounter date is ' + getValue('encounterDate.value') + '.') 
             });
    });
    
    $j(function() {
             getField('encounterLocation.value').change(function() {
             window.alert('Location is ' + getValue('encounterLocation.value') + '.') 
             });
    });
    
    $j(function() {
             getField('encounterProvider.value').change(function() {
             window.alert('Provider is ' + getValue('encounterProvider.value') + '.') 
             });
    });
    

getValue(idAndProperty)

...

  • argument: idAndProperty the field you want to get (for example "weight.value")
  • returns: the value of the specified field
    Example for obs (since: 1.6.8):
    Code Block
    $j(function() {
         window.alert('You entered ' + getValue('weight.value') + 'kg as the weight');
    });
    
    Example for encounter details (since: 1.9.1):
    Code Block
    $j(function() {
             window.alert('Encounter date is ' + getValue('encounterDate.value') 
               + '.\nEncounter date error is ' + getValue('encounterDate.error') 
                 + '.\nEncounter location is ' + getValue('encounterLocation.value') 
           + '.\nEncounter location error is ' + getValue('encounterLocation.error') 
                           + '.\nProvider is ' + getValue('encounterProvider.value') 
                     + '.\nProvider error is ' + getValue('encounterProvider.error') + '.') 
    });
    

setValue(idAndProperty)

...