locked
Writing an 'OR' statment in JavaScript RRS feed

  • Question

  •  

    Real simple question I hope. I was wondering what the symbol for 'OR' is if i'm writing an 'if' statement. Say i have 3 fields and I want to write a script that changes the 3rd field based on a value in field 'A' OR field 'B'. I know how to do an 'AND' statement (&&) just wondering if there's a short version of OR.

     

    In addition, is there a way to set a pick list's value based on another field. For example if the campaign field is not null then set source to Marketing (datavalue 3)?

    Wednesday, November 19, 2008 9:19 PM

Answers

  • Code Snippet

    if(crmForm.all.subjectid.DataValue != null || crmForm.all.name.DataValue != null || crmForm.all.myfield == "test")

    {

    alert("this is an or statement");

    }

     

     

     

     

    Thursday, November 20, 2008 2:14 AM
  •  

    Hi,

     AND - &&

     OR - ||

    Thursday, November 20, 2008 5:46 AM

All replies

  • Code Snippet

    if(crmForm.all.subjectid.DataValue != null || crmForm.all.name.DataValue != null || crmForm.all.myfield == "test")

    {

    alert("this is an or statement");

    }

     

     

     

     

    Thursday, November 20, 2008 2:14 AM
  •  

    Hi,

     AND - &&

     OR - ||

    Thursday, November 20, 2008 5:46 AM
  • Thank you both that was very helpful

    Thursday, November 20, 2008 4:32 PM