Replacing Text

J

Jen

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!
 
L

Lee

Jen said:
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?


--
 
J

Jen

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.
 
T

TheBagbournes

Jen said:
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.
 
L

Lee

Jen said:
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";
}


--
 
E

Evertjan.

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

Or:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top