From: jr on
The psuedocode is

1. if "search_bu" is empty
then return false because it is a required field


2. if "search_zoneid has a value
then if search_zonenm is empty return false

3 OR the reverse of 2
if "search_zonenm has a value
then if search_zoneid is emtpy return false


I think what it is doing know is working on all 3 but if I don't input
either a zoneid or zonenm it still asks for the zonenumber?????
It may be number 2 and 3 need to be an OR someway? The problem is
zoneid or zonenm are not rquired but it is acting like they are
required.
They are only required if one of those fields has a value.

thanks,

JanisR

function checkscript() {

if (document.forms[0].search_bu.value == '' ||
document.forms[0].search_bu.value== null ) {
// something else is wrong
alert('The Business Unit is a required field!');
return false;
}
else if (document.forms[0].search_zoneid.value != '' ||
document.forms[0].search_zoneid.value!=null) {
if (document.forms[0].search_zonenm.value == '' ||
document.forms[0].search_zonenm.value==null ){
alert('You must input the zone number if you search on
zone id!');
return false;
}

}
else if (document.forms[0].search_zonenm.value != '' ||
document.forms[0].search_zonenm.value!= null) {
if (document.forms[0].search_zoneid.value == '' ||
document.forms[0].search_zoneid.value==null ){
alert('You must input the zone number if you search on
zone id!');
return false;
}

//}
// if true you can submit the form

return true;
}
</script>
From: Stefan Weiss on
On 08/07/10 03:36, jr wrote:
> The psuedocode is
>
> 1. if "search_bu" is empty
> then return false because it is a required field
[snip]

You already got replies to this question in a different thread, there's
no need to start another. It would also make things a lot easier if you
could just post a link to your form.


--
stefan
From: jr on
On Jul 7, 6:49 pm, Stefan Weiss <krewech...(a)gmail.com> wrote:
> On 08/07/10 03:36, jr wrote:> The psuedocode is
>
> > 1.  if "search_bu"  is empty
> >      then return false because it is a required field
>
> [snip]
>
> You already got replies to this question in a different thread, there's
> no need to start another. It would also make things a lot easier if you
> could just post a link to your form.
>
> --
> stefan

the reason I don't have a sample online is I have mysql & php server
configured for localhost testing and I just changed the configuration
to allow remote access and the server won't start but I will have it
ironed out hopefully by tomorrow. The only reason I reposted is these
spam drug sales messages totally eclipse your first post and you don't
know if anyone will go back there again. So I think you are saying
just validate for the required field and I handle the two fields that
require each other a different way? OkaY, i went back and read it and
found your answer thansk,
From: SAM on
Le 7/8/10 3:36 AM, jr a �crit :
> The psuedocode is

No interest !

Read, understand, given answers to you others posts.

And first, learn to code correctly HTML.
(before to try to play with JS)

Learn to use the Errors Consoles of your Navigators.

Learn to bebbug your scripts,
how to use JS that can show you from where errors are comming
try ... catch
or, at least :

if (document.forms[0] &&
document.forms[0].bu &&
document.forms[0].bu.value &&
document.forms[0].bu.value.length < 1
}
{
alert('something wrong');
}

or, probably better :

if (!!document.forms[0] )
{
var m = 'form is known\n';
if (!!document.forms[0].bu)
{ alert('element nammed "bu" is known');
if(!!document.forms[0].bu.value)
{ alert('value of "bu" is known');
if(!!document.forms[0].bu.value.length < 1)
{
alert('"bu" is empty');
}
else alert('value o "bu" = '+document.forms[0].bu.value);
}
else alert('"bu" has no value');
}
else alert('no element "bu" !');
}
else alert('No such form in this page');

--
sm
From: SAM on
Le 7/8/10 6:53 AM, jr a �crit :
> On Jul 7, 6:49 pm, Stefan Weiss <krewech...(a)gmail.com> wrote:
>> On 08/07/10 03:36, jr wrote:> The psuedocode is
>>
>>> 1. if "search_bu" is empty
>>> then return false because it is a required field
>> [snip]
>>
>> You already got replies to this question in a different thread, there's
>> no need to start another. It would also make things a lot easier if you
>> could just post a link to your form.
>
> the reason I don't have a sample online is I have mysql & php server

blah !
can't you try localy on a stand-alone html file ?

> The only reason I reposted is these
> spam drug sales messages totally eclipse your first post and you don't

???

can't you clic on subject then ask to your news-reader to sort on that
subject ?

can't your remenber wich subjects you yourself launched ?

Does any one could explain how to plonk that spams ?



> So I think you are saying
> just validate for the required field and I handle the two fields that
> require each other a different way?

"I" think you have to :
- get care your fingers don't tape what they have not to tape
var d = docuement.getElementById('bu');
will give a JS error
- take habit to see that 'bu' in the JS script
can't be 'BU' in html code
var d = document.getElementById('bu')
will give a JS error if html code is :
<div id="BU">blah</div>

Just to give a JS function that treats elements in html
without giving that html
is not enough to debug your work.

--
sm