Click to See Complete Forum and Search --> : writing two methods using the ||


cmotor
09-11-2003, 03:53 PM
I want to write if the current field value has not changed or the field is empty.

How would I change the code below:

if (isEmpty(document.Returnform.return_reason_details.value)



Thanks
-cmotor

Exuro
09-11-2003, 05:49 PM
When you say "has not changed", I assume that means that you have some that acts on a text element more than once. If I were you, somewhere in the code I'd add something like this:

var lastValue = document.Returnform.return_reason_details.value;

You could then use the variable lastValue to compare with the new value of the text element. After that, I think you could change your If statement to something like this:

if(isEmpty(document.Returnform.return_reason_details.value) || document.Returnform.return_reason_details.value == lastValue)

cmotor
09-11-2003, 06:33 PM
Works great.
Thanks man.