Connecting Tech Pros Worldwide Forums | Help | Site Map

Replacing Text

Jen
Guest
 
Posts: n/a
#1: Jan 25 '07
Is it possible to do something like this with JavaScript?

If doc.Folder = "Select Doc Type"
Change doc.Folder to = "Journal Invoice"

I have been playing around with this, and just can't seem to get the
right syntax.

Thanks!


Lee
Guest
 
Posts: n/a
#2: Jan 25 '07

re: Replacing Text


Jen said:
Quote:
>
>Is it possible to do something like this with JavaScript?
>
>If doc.Folder = "Select Doc Type"
>Change doc.Folder to = "Journal Invoice"
>
>I have been playing around with this, and just can't seem to get the
>right syntax.
What have you tried?


--

Jen
Guest
 
Posts: n/a
#3: Jan 25 '07

re: Replacing Text




On Jan 25, 12:13 pm, Lee <REM0VElbspamt...@cox.netwrote:

What have you tried?

I have tried:
If doc.Folder = "Select Doc Type"
then doc.Folder = "AR Invoice";

var rename = doc.Folder

If rename = "Select Doc Type"
doc.Folder = "AR Invoice";

I am really not good at writing code, so I am sure that these aren't
even close to being correct.

TheBagbournes
Guest
 
Posts: n/a
#4: Jan 25 '07

re: Replacing Text


Jen wrote:
Quote:
>
On Jan 25, 12:13 pm, Lee <REM0VElbspamt...@cox.netwrote:
>
What have you tried?
>
I have tried:
If doc.Folder = "Select Doc Type"
then doc.Folder = "AR Invoice";
>
var rename = doc.Folder
>
If rename = "Select Doc Type"
doc.Folder = "AR Invoice";
>
I am really not good at writing code, so I am sure that these aren't
even close to being correct.
Have you considered learning Javascript? It would help a lot.
Lee
Guest
 
Posts: n/a
#5: Jan 25 '07

re: Replacing Text


Jen said:
Quote:
>
>
>
>On Jan 25, 12:13 pm, Lee <REM0VElbspamt...@cox.netwrote:
>
>What have you tried?
>
>I have tried:
>If doc.Folder = "Select Doc Type"
> then doc.Folder = "AR Invoice";
>
>var rename = doc.Folder
>
>If rename = "Select Doc Type"
>doc.Folder = "AR Invoice";
>
>I am really not good at writing code, so I am sure that these aren't
>even close to being correct.
I wouldn't say you're not good at writing code.
What you're really bad at seems to be research.

The Javascript "if..else" syntax is described here:
http://docs.sun.com/source/816-6408-10/stmt.htm#1004833

The comparison operators are here:
http://docs.sun.com/source/816-6408-10/ops.htm#1060974


if ( doc.Folder == "Select Doc Type" ) {
doc.Folder = "AR Invoice";
}


--

Evertjan.
Guest
 
Posts: n/a
#6: Jan 25 '07

re: Replacing Text


Lee wrote on 25 jan 2007 in comp.lang.javascript:
Quote:
>
if ( doc.Folder == "Select Doc Type" ) {
doc.Folder = "AR Invoice";
>}
>
Or:

doc.Folder =
doc.Folder.replace(/^Select Doc Type$/,'AR Invoice';





--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Closed Thread