Set a Value of a field when changed

Hi

I have a field (FIELD1) that when changed, needs to set another field (FIELD2) to "No" (dialog list). If possible, I would like this to work in the onChange of FIELD1. I've looked around this site briefly but I can't find what I need, maybe I'm not good at looking, so I thought I'd ask. This is with version 7.0

Thanks
nigelboyleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

marilyngCommented:
Is field1 or field2 the dialog list? Is this a web application, notes client or both.
The onChange event will only work in a browser.  You would need to set a temporary value of field1 when the form opens in edit mode (onLoad for web, or postopen and postmodechange for Notes Client), in order to see if the value of field1 changes.

Notes client:  (also put in postmodechange event)
Sub Postopen(Source As Notesuidocument)
      If Not source.IsNewDoc Then
            If source.EditMode Then
                  Dim doc As NotesDocument
                  Set doc = source.document
                  doc.field1_old = doc.field1(0)
            End If
      End If
End Sub

Input translation of Field1:
oldValue:=field1_old;
newValue:=Field1;
@If(oldValue !="" & oldValue !=field1; @SetField("field2"; "Yes"); @SetField("field2";"No"));
Field1

In exit event of field1:
Sub Exiting(Source As Field)
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Set uidoc =ws.currentdocument
      If uidoc.editmode Then uidoc.refresh
End Sub

Web...................................................................
OnLoad:  
one = window.document.forms[0].Field1.value
window.document.forms[0].field1_old.value = one

onChange (or onblur):
one = window.document.forms[0].Field1.value
old = window.document.forms[0].field1_old.value

if (one != old) {
    window.document.forms[0].Field2.value = "Yes" }
    else {
      window.document.forms[0].field2.value = "No"
      }

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sjef BosmanGroupware ConsultantCommented:
Before opening up Pandora's box with goodies, may we have your codes please?
nigelboyleAuthor Commented:
It was for the Notes Client, and using the code you set I managed to sort out the problem.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.