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: added $j(function() { to jQuery examples with getField, getValue, and setValue

...

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

getValue(idAndProperty)

Gets the value of a field.

  • argument: idAndProperty the field you want to get (for example "weight.value")
  • returns: the value of the specified field
  • since: 1.6.8
    Example:
    Code Block
    
    $j(function() {
         window.alert('You entered ' + getValue('weight.value') + 'kg as the weight');
    });
    

setValue(idAndProperty)

Sets the value of a field

  • argument: idAndProperty the field you want to set the value of (for example "weight.value")
  • value: the value you want to set
  • since: 1.6.8
    Example:
    Code Block
    
    $j(function() {
         setValue('weight.value', 74);
         setValue('scheduledVisit.value', true);
         setValue('howTravelClinic.value', 456); // 456 is a concept id that's a legal answer to this question
    });
    

Additional jquery examples

...