variable not passed correctly 
Author Message
 variable not passed correctly

I am calling a javascript function from a VBScript function in IIS 4.  All
seems to go well, but a string comparision fails in javascript.  The
javascript function's if statement never returns true when ParentId field is
"".  See code below.  Any thoughts?

thanks,

Craig Buchanan

vbscript
....

ParentId  = ""
AddPost ArticleId, ThreadId, MessageId, Cstr(ParentId), Subject, Author,
Sent
...

javascript

...
function AddPost (article_id, thread_id, message_id, parent_id, subject,
author, postdate) {

 if ( (parent_id == "") || (parent_id == null) )
    //should do something when parent_id is a zero-length string, but never
gets in here!

 else {
    //do something else
...



Wed, 25 Jun 2003 08:02:57 GMT  
 variable not passed correctly
There must be more to the problem than you posted.

The following simple mixed language .wsf example behaves exactly as
expected:

<job>
<script language="Jscript">
  function foobar(arg)
  {
    if((arg == "") || (arg == null))
      WScript.echo("True")
    else
      WScript.echo("False")
  }
</script>
<script language="VBScript">
  s = ""
  foobar s
  foobar cstr(s)
</script>
</job>

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--



Quote:
> I am calling a javascript function from a vbscript function in IIS 4.  All
> seems to go well, but a string comparision fails in javascript.  The
> javascript function's if statement never returns true when ParentId field
is
> "".  See code below.  Any thoughts?

> thanks,

> Craig Buchanan

> vbscript
> ....

> ParentId  = ""
> AddPost ArticleId, ThreadId, MessageId, Cstr(ParentId), Subject, Author,
> Sent
> ...

> javascript

> ...
> function AddPost (article_id, thread_id, message_id, parent_id, subject,
> author, postdate) {

>  if ( (parent_id == "") || (parent_id == null) )
>     //should do something when parent_id is a zero-length string, but
never
> gets in here!

>  else {
>     //do something else
> ...



Wed, 25 Jun 2003 16:30:52 GMT  
 variable not passed correctly
You are right, something else was happening.  Thanks for the help.

Craig Buchanan


There must be more to the problem than you posted.

The following simple mixed language .wsf example behaves exactly as
expected:

<job>
<script language="Jscript">
  function foobar(arg)
  {
    if((arg == "") || (arg == null))
      WScript.echo("True")
    else
      WScript.echo("False")
  }
</script>
<script language="VBScript">
  s = ""
  foobar s
  foobar cstr(s)
</script>
</job>

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--



Quote:
> I am calling a javascript function from a vbscript function in IIS 4.  All
> seems to go well, but a string comparision fails in javascript.  The
> javascript function's if statement never returns true when ParentId field
is
> "".  See code below.  Any thoughts?

> thanks,

> Craig Buchanan

> vbscript
> ....

> ParentId  = ""
> AddPost ArticleId, ThreadId, MessageId, Cstr(ParentId), Subject, Author,
> Sent
> ...

> javascript

> ...
> function AddPost (article_id, thread_id, message_id, parent_id, subject,
> author, postdate) {

>  if ( (parent_id == "") || (parent_id == null) )
>     //should do something when parent_id is a zero-length string, but
never
> gets in here!

>  else {
>     //do something else
> ...



Sat, 28 Jun 2003 11:56:19 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. variable not passed correctly

2. Help, OA ByRef parameters not passed correctly

3. Help, OA ByRef parameters not passed correctly

4. Environment Variable not reporting correctly (TEMP)

5. Creating ADO recordset w/o database .Append not working correctly IIS5 win2000 Prof not .Net

6. POST variables not passed using ASP

7. POST variables not passed using WININET/ASP

8. Errors with VBScript macro - Can't Create Object, Script Engine Not Installed Correctly

9. frame "cols" not updating correctly

10. psnup seams not to work correctly

11. How to Control the Focus (The Setfocus can not run correctly)

12. DateLastAccessed Property not reporting correctly ?

 

 
Powered by phpBB® Forum Software