Hi James,

Something like this should work:

<htmlform>
...
<submit submitClass="submitButton"/>
...
<script>
$j(function() {
    $j('.submitButton').click(function(event) {
        if ( /* do some logic here */ ) {
            window.alert("Cannot submit because XYZ");
            event.preventDefault();
        }
    });
});
</script>
</htmlform>

-Darius

On Wed, Nov 9, 2011 at 8:32 AM, James Arbaugh <[email protected]> wrote:

> I need to require another field to be entered if a date field has a
> value.  Is there a way to trigger a Javascript when the submit button is
> clicked, before the form is accepted?****
>
> ** **
>
> To be more specific, I need to require the hospital discharge status field
> to be filled out if the form has a discharge date.  If the discharge date
> is set, but the discharge status is empty I want to give an error message
> and not accept the form.  I can’t simply set the field as required because
> the form is only partially filled out at the time of admission.  The
> discharge date and discharge status are not known at that time.****
>
> ** **
>
> Thanks,****
>
> James****
>
> ** **
>
> ** **
> ------------------------------
> Click here to 
> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from
>  OpenMRS Implementers' mailing list

_________________________________________

To unsubscribe from OpenMRS Implementers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-implement-l" in the  body 
(not the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l]

Reply via email to