Click to See Complete Forum and Search --> : Calling variable in a string
I have a function:
<SCRIPT language="JavaScript1.2">
function addNew() {
var tableName = document.add.TableName.value;
alert(tableName);
document.add.action="/Web/Workflow?TableName=";
document.add.method="post";
document.add.target="list";
var tableName = document.add.TableName.value;
alert(tableName);
document.add.submit();
}
</SCRIPT>
I want to use the variable 'tableName' in
document.add.action="/Web/Workflow?TableName=variable";
How can I do this?
Khalid Ali
07-21-2003, 12:25 PM
Like this
document.add.action="/Web/Workflow?TableName="+TableName;
Thanks Khalid..
I have something like this and it does not work for me
document.add.action="/Web/Workflow?TableName=+TableName&action="+TableNameNew;
I'm trying to call the variable for the "action" parameter and append the variable with New
Nevermore
07-21-2003, 12:55 PM
Originally posted by mili
I have something like this and it does not work for me
document.add.action="/Web/Workflow?TableName=+TableName&action="+TableNameNew;
I'm trying to call the variable for the "action" parameter and append the variable with New
If I understand you correctly, you need this:
document.add.action="/Web/Workflow?TableName="+TableName+"&action="+TableNameNew;
Khalid Ali
07-21-2003, 01:04 PM
Originally posted by mili
document.add.action="/Web/Workflow?TableName=+TableName&action="+TableNameNew;
You have to remember how to concatenate strings in javascript.
"this is a string "
" this is a second string"
var IamAVariable = "I am a variable";
you will always have to make sure that you follow the pattern now to concatenate the strings and variable above this is what you wil need to do.
"this is a string "+IamAVariable+ " this is a second string"
now see the above description and then try to resconstruct your action string
Thanks...but I get this error TableNameNew is undefined.
I'm trying to append the variable with the word New.