Chris Bottomley
asked on
VBS to Javascript 2
I have a routine used by a simple development page that I need converting to work as Javascript. As it is it effectively concatenates two strings:
strBuild is the concateneated string so far.
strItem is the string to add and could be blank or a constant "File Not Required"
If the string is blank, null or not required then the original strBuild string is returned otherwise if strbuild is not blank a comma is added in preparation for adding the stritem then the string is returned as the function result.
Chris
strBuild is the concateneated string so far.
strItem is the string to add and could be blank or a constant "File Not Required"
If the string is blank, null or not required then the original strBuild string is returned otherwise if strbuild is not blank a comma is added in preparation for adding the stritem then the string is returned as the function result.
Chris
function retFileNames(strBuild, strItem)
if stritem = "File Not Required" or stritem = "" or stritem = "None" then
retFileNames = strbuild
else
if strbuild = "" then
retFileNames = stritem
else
retFileNames = strBuild & "," & stritem
end if
end if
end function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
in line 12 you pass in strFileNames.
still i dont see where you have initialized that variable.
if you have not initialized this variable before argumenting it into retFileNames, you pretty much found the issue.
what browser are you using? if firefox / chrome / opera you could use the debug console to see where the errors are.
could you post required code for this to run so i could debug this for errors?
still i dont see where you have initialized that variable.
if you have not initialized this variable before argumenting it into retFileNames, you pretty much found the issue.
what browser are you using? if firefox / chrome / opera you could use the debug console to see where the errors are.
could you post required code for this to run so i could debug this for errors?
ASKER
Unfortunately i'm not at work so I am working with some but not all the files .. and they would need further redacting to do so - that would therefore mean a postponement till Monday... hopefully not a biggie but I sense it is so darned close!
As for strFileNames, I wasn't initialising it as I didn't think it critical, but have done so and after fixing a few more issues am seeing the strFileNames output at line 22 fine. The next thing was the form hidden parameter files was actually Files but on correcting I still nothing into the form parameter ... and from VBS at the same point the transfer of the string is fine and therefore it would seem to lie with the line:
document.getElementById("f iles").val ue = strfilenames;
corrected in code as:
document.getElementById("F iles").val ue = strFileNames;
Chris
As for strFileNames, I wasn't initialising it as I didn't think it critical, but have done so and after fixing a few more issues am seeing the strFileNames output at line 22 fine. The next thing was the form hidden parameter files was actually Files but on correcting I still nothing into the form parameter ... and from VBS at the same point the transfer of the string is fine and therefore it would seem to lie with the line:
document.getElementById("f
corrected in code as:
document.getElementById("F
Chris
ASKER
Correction, found another bad case variable, the failure mode is a bit dramatic when it happens but thanks it's working ... will try next week on FF but for now it has switched from VBS to JS on IE and that's what I was looking for so many thanks.
Chris
Chris
ASKER
Partial accuracy since there were some case errors in teh supplied code but since the info was supplied re the sensitivity to case it is churlish to say anything other than accurate.
Chris
Chris
ASKER
strFileName = InObj.value;
All is well, used an alert to demonstrate the file name, but it never passes any data and seems to fall over since I set an alert after the line:
strFileNames = retFileNames(strFileNames,
And this alert is not generated .. the rest of the page then falls over for the lack of data. I include the case corrected?
Case for the combo titles is correct. The combos return a file path as something alomg the following lines:
startpoint\subfolder\subsu
Where startpoint is the root of the server
Chris
Open in new window