deltex141
asked on
Problems pulling in Javascript Form Variables containing a ForwardSlash (/)
I have a Javascript function that pulls in a couple of variables from a form, it works fine until it tries to pull in a variable that contains a forwardslash ( / ), then it just cuts off the field at the slash.
The function looks like this:
function runJob() {
var shell = new ActiveXObject("WScript.she ll");
shell.run("S:/function.bat "+frmTable.Item.value+" "+frmTable.Serial.value);
}
So, for the Serial value, it will pull in a field of 12345 just fine, but a field of 12345/6789 will cut off at the /
For clarification here is the variable as declared in the table
<td align="right">~{sSerialNum ber}:</td>
<td align="left"><input type="text" name="Serial" size="12" maxlength="30" onfocus="this.scrollIntoVi ew(false)" /></td>
Any ideas?
The function looks like this:
function runJob() {
var shell = new ActiveXObject("WScript.she
shell.run("S:/function.bat
}
So, for the Serial value, it will pull in a field of 12345 just fine, but a field of 12345/6789 will cut off at the /
For clarification here is the variable as declared in the table
<td align="right">~{sSerialNum
<td align="left"><input type="text" name="Serial" size="12" maxlength="30" onfocus="this.scrollIntoVi
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It'll be replaced with an escaped slash It should work perfectly.
yes as kylealanhale said, it will escape the "/" as it is conflicting with your code. Don't worry, the / won't get deleted or removed.
hope this helps.
hope this helps.
ASKER
That worked great, Thanks!
ASKER
var serialValue = frmTable.Serial.value;
serialValue = serialValue.replace("/","\
var shell = new ActiveXObject("WScript.she
shell.run("S:/function.bat
}
What is the / going to be replaced with? We still need the slash to be pulled in, not just replaced or removed