Split function in javaScript

Dear all,

how to integrate/ combine both of the script below?

a) var checkList = new String(getFieldValue(document.forms[0].zTempTo)).split(“,”)

for (i=0;i<checkList.length;i++)

{

if (checkList[i]==“PRD CLIENT (010)”)

{

document.forms[0].zStage.value = “Publish”;

document.forms[0].submit();

}

}

b) var checkList = new String(getFieldValue(document.forms[0].zTempTo)).split(“,”)

for (i=0;i<checkList.length;i++)

{

if (checkList[i] !=“PRD CLIENT (010)”)

{

document.forms[0].zStage.value = “new”;

document.forms[0].submit();

}

}

any help would be highly appreciated

Thanks in advance…

Subject: split function in javaScript

Am i missing something ??? :)If not, its quite simple.

var checkList = new String(getFieldValue(document.forms[0].zTempTo)).split(“,”)

for (i=0;i<checkList.length;i++)

{

if (checkList[i]==“PRD CLIENT (010)”)

{

document.forms[0].zStage.value = "Publish";

document.forms[0].submit();

}

else

{

document.forms[0].zStage.value = "new";

document.forms[0].submit();

}

}

Subject: RE: split function in javaScript

really thanks for your response, Johny…

But it cannot work fine… when the checklist[i] ]==“PRD CLIENT (010)”), it didn’t set the zStage value to “Publish” but it set zStage value to “new”.

By right, it should perform the first case.

Any idea?.

thanks in advance…

Subject: RE: split function in javaScript

Windy,

Can i assume that you want to set value to “Publish” if any one of the value in array is PRD CLIENT (010)? If yes, the following will help u.

var checkList = new String(getFieldValue(document.forms[0].zTempTo)).split(“,”)

var prdclientfound=“”;

for (i=0;i<checkList.length;i++)

{

if (checkList[i]=="PRD CLIENT (010)")

{

	prdclientfound="Yes"	

}

}

if (prdclientfound == “Yes”)

{

document.forms[0].zStage.value = "Publish";

document.forms[0].submit();

}

else

{

document.forms[0].zStage.value = "new";

document.forms[0].submit();

}

Subject: RE: split function in javaScript

really thanks for your help, Johny…it worked like a charm now…

TQ…