Still trying to get my head around some simple javascript issues the following works in php but not in javascript can someone point me in the right direction obviously my code is wrong.

if((dobyear==false) && (dobmonth==false) && (dobday==true))
{
return 'noyearmonth';
}

thanks

What are dobyear,dobmonth,dobday? Are they set to be boolean values or are you trying to see if they have a value at all? If they are not boolean values you might try:

if(!dobyear && !dobmonth && dobday)
{
return 'noyearmonth';
}

You can also do it as:

if(dobyear == null && dobmonth == null && dobday != null)
{
return 'noyearmonth';
}

thanks scrappedcola your first way works fine

first way works fine

Yes, but does that make any sense?
An error is returned only when: dobday exists and BOTH dobyear and dobmonth are absent.
I suspect that you really want: dobday exists and EITHER dobyear or dobmonth is absent.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.