1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

VBscript boolean function causes Javscript to bomb

Discussion in 'JavaScript and AJAX' started by calgarychinese, Aug 25, 2008.

  1. calgarychinese

    calgarychinese Banned

    Joined:
    Aug 25, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi there

    I have a server-side VB that runs at the beginning of the asp page, and it returns a result set, call it loResultSet.

    In the client side javscript, I was trying to check to see if this result set is nothing or not.

    if (<%=(loResultSet is nothing)%>)

    {

    // javscript code

    }



    However it bombs because that (loResultSet is nothing) returns "True", as opposed to "true", and Javascript doesn't recognize True.

    I know this is a dumb question, but how would you fix this, and I mean, not in a hack way, such as

    if (%=(loResultSet is nothing)%>.toString().toLowerCase())



    Many thanks appreciated.

    CC
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    Code:
    if (eval("<%=(loResultSet is nothing)%>%>".toString().toLowerCase()))
    
    {
    
    // javscript code
    
    }
    
    Try this!
     
  3. calgarychinese

    calgarychinese Banned

    Joined:
    Aug 25, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi pradeep, however how is your solution different than mine except for the eval part you added? (I was actually hoping there would be some standard function to do that, for us to manipulate the results like this looks a little counter-productive - I guess that's the diff between javascript and vbscript...)

    Thanks
     

Share This Page