ASP/JScript

Discussion in 'ASP General' started by Excel User, Sep 15, 2009.

  1. Excel User

    Excel User Guest

    Hi,

    I using ASP/JScript and have the following but receive an error 'Object
    Required'

    myvalue = Request("value");
    myvalue = UCase(myvalue);

    Any ideas - I familiar with ASP/VBS but not ASP/JScript

    Thanks
    Excel User, Sep 15, 2009
    #1
    1. Advertising

  2. Excel User wrote:
    > Hi,
    >
    > I using ASP/JScript and have the following but receive an error 'Object
    > Required'
    >
    > myvalue = Request("value");
    > myvalue = UCase(myvalue);
    >
    > Any ideas - I familiar with ASP/VBS but not ASP/JScript


    Something like:
    var myvalue = String (Request ("value"));
    myvalue = myvalue.toUpperCase (); // assuming not null

    MC
    MightyChaffinch, Sep 15, 2009
    #2
    1. Advertising

  3. Excel User

    Excel User Guest

    Thanks MC - that's great!

    "MightyChaffinch" <> wrote in message
    news:...
    > Excel User wrote:
    >> Hi,
    >>
    >> I using ASP/JScript and have the following but receive an error 'Object
    >> Required'
    >>
    >> myvalue = Request("value");
    >> myvalue = UCase(myvalue);
    >>
    >> Any ideas - I familiar with ASP/VBS but not ASP/JScript

    >
    > Something like:
    > var myvalue = String (Request ("value"));
    > myvalue = myvalue.toUpperCase (); // assuming not null
    >
    > MC
    >
    Excel User, Sep 15, 2009
    #3
  4. Excel User

    Evertjan. Guest

    MightyChaffinch wrote on 15 sep 2009 in
    microsoft.public.inetserver.asp.general:

    > Excel User wrote:
    >> Hi,
    >>
    >> I using ASP/JScript and have the following but receive an error
    >> 'Object Required'
    >>
    >> myvalue = Request("value");


    Use var for new variables

    do not use "value" as a input name in html forms

    Never use the whole request object,
    you could end up with nasty surprises, so:


    var myvalue = Request.form("myValue");

    or

    var myvalue = Request.querystring("myValue");


    >> myvalue = UCase(myvalue);


    That is VBS, not JS

    >> Any ideas - I familiar with ASP/VBS but not ASP/JScript

    >
    > Something like:
    > var myvalue = String (Request ("value"));
    > myvalue = myvalue.toUpperCase (); // assuming not null


    Request.form() and Request.querystring()
    always return a string, I think,
    never a null. No conversion necessary.

    var myValueUpper = Request.form("myValue").toUpperCase();





    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Sep 15, 2009
    #4
  5. Excel User

    Excel User Guest

    Evertjan,

    Thanks for the pointers, I will amend as revealed.

    Thanks

    "Evertjan." <> wrote in message
    news:Xns9C87D12F67209eejj99@194.109.133.242...
    > MightyChaffinch wrote on 15 sep 2009 in
    > microsoft.public.inetserver.asp.general:
    >
    >> Excel User wrote:
    >>> Hi,
    >>>
    >>> I using ASP/JScript and have the following but receive an error
    >>> 'Object Required'
    >>>
    >>> myvalue = Request("value");

    >
    > Use var for new variables
    >
    > do not use "value" as a input name in html forms
    >
    > Never use the whole request object,
    > you could end up with nasty surprises, so:
    >
    >
    > var myvalue = Request.form("myValue");
    >
    > or
    >
    > var myvalue = Request.querystring("myValue");
    >
    >
    >>> myvalue = UCase(myvalue);

    >
    > That is VBS, not JS
    >
    >>> Any ideas - I familiar with ASP/VBS but not ASP/JScript

    >>
    >> Something like:
    >> var myvalue = String (Request ("value"));
    >> myvalue = myvalue.toUpperCase (); // assuming not null

    >
    > Request.form() and Request.querystring()
    > always return a string, I think,
    > never a null. No conversion necessary.
    >
    > var myValueUpper = Request.form("myValue").toUpperCase();
    >
    >
    >
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
    Excel User, Sep 15, 2009
    #5
  6. Evertjan. wrote:
    > MightyChaffinch wrote on 15 sep 2009 in
    > microsoft.public.inetserver.asp.general:
    >
    >> Excel User wrote:
    >>> Hi,
    >>>
    >>> I using ASP/JScript and have the following but receive an error
    >>> 'Object Required'
    >>>
    >>> myvalue = Request("value");

    >
    > Use var for new variables
    >
    > do not use "value" as a input name in html forms
    >
    > Never use the whole request object,
    > you could end up with nasty surprises, so:
    >
    >
    > var myvalue = Request.form("myValue");
    >
    > or
    >
    > var myvalue = Request.querystring("myValue");
    >
    >
    >>> myvalue = UCase(myvalue);

    >
    > That is VBS, not JS
    >
    >>> Any ideas - I familiar with ASP/VBS but not ASP/JScript

    >> Something like:
    >> var myvalue = String (Request ("value"));
    >> myvalue = myvalue.toUpperCase (); // assuming not null

    >
    > Request.form() and Request.querystring()
    > always return a string, I think,
    > never a null. No conversion necessary.


    I've had datatype problems using various parts of ASP & ADO from JScript
    - I've adopted a defensive approach as a result.

    The String (...) construct tells tells the script engine I want a
    string, and tells me it's a string. I'll stick with it but YMMV...

    MC
    MightyChaffinch, Sep 16, 2009
    #6
  7. Excel User

    Evertjan. Guest

    MightyChaffinch wrote on 16 sep 2009 in
    microsoft.public.inetserver.asp.general:

    >> Request.form() and Request.querystring()
    >> always return a string, I think,
    >> never a null. No conversion necessary.

    >
    > I've had datatype problems using various parts of ASP & ADO from JScript
    > - I've adopted a defensive approach as a result.
    >
    > The String (...) construct tells tells the script engine I want a
    > string, and tells me it's a string. I'll stick with it but YMMV...


    There is a difference between what you do yourself
    and what is reasonable to advice in this NG.

    Request.form() and Request.querystring() are not part of JS or VBS,
    but ASP-platform functionalities.
    They always return a [perhaps empty] string, as is simple to test.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Sep 16, 2009
    #7
  8. Excel User

    Evertjan. Guest

    Dave Anderson wrote on 18 sep 2009 in
    microsoft.public.inetserver.asp.general:

    > "Evertjan." wrote:
    >> Request.form() and Request.querystring() are not part of JS or VBS,
    >> but ASP-platform functionalities.
    >> They always return a [perhaps empty] string, as is simple to test.

    >
    > They return neither, unless you capitalize them. And then they return
    > objects. If you really want the string value, use this:


    You are partly right, Dave:

    Request needs a capital.

    Form and Item do not

    > Request.Form("elementname").Item
    > Request.QueryString("elementname").Item


    Response.wriTe(Request.querysTriNg("a").item);

    works fine here, but:

    Response.wriTe(Request.queryString("a").iTem);

    does not.

    > And then they return objects.


    Objects that default to a string, if the there is only one,
    otherwise to a collection. [how strange of the Original Programmers]

    > You can, of course, also examine:
    >
    > Request.Form("elementname").Count
    > Request.QueryString("elementname").Count


    True [? true]


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Sep 18, 2009
    #8
  9. Excel User

    Evertjan. Guest

    Dave Anderson wrote on 19 sep 2009 in
    microsoft.public.inetserver.asp.general:

    > "Evertjan." wrote:
    >>> And then they return objects.

    >>
    >> Objects that default to a string, if the there is only
    >> one, otherwise to a collection. [how strange of the
    >> Original Programmers]

    >
    > They do not "default to" strings. They have default properties that
    > are strings, and once you try using them outside the friendly confines
    > of the Response Object, you will understand that this is worthless
    > information in a JScript environment.


    I don't understand.

    Defaulting allways is with respect to use.

    if (Request.querystring('elementname')=='')
    // the above is outside the Response object, as you put it.
    Response.wRIte('empty or absent');

    >
    > Given:
    > var myValue = Request.QueryString("elementname")
    >
    > Compare:
    > Response.Write(myValue)
    > Response.Write(myValue.length)
    >
    > You claim it's a string. Why doesn't it have a length?


    I do not claim ir IS a a string,
    I claim it defaults to a string [unless it is a collection]

    Your second example:

    Response.Write(myValue.length);

    is a non default use by definition.

    > this is worthless information in a JScript environment.


    It seems it is valuable information in yours.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Sep 19, 2009
    #9
  10. Excel User

    Evertjan. Guest

    Dave Anderson wrote on 22 sep 2009 in
    microsoft.public.inetserver.asp.general:

    >> is a non default use by definition.

    >
    > By whose definition?


    Mine, of course. What a question.

    > If, as you claim, it "defaults" to a string, then
    > that string will have properties. In JScript, [length] is one of those
    > properties. Would you prefer this to make it more "defaulty"?


    You are wrong in my definition.

    A dom example:

    if window.location defaults to window.location.href

    that does not mean

    window.location.hash acts as window.location.href.hash

    or

    window.location.search acts as window.location.href.search

    But feel free to define "defaults otherwise, Dave.



    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Sep 22, 2009
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TdJ
    Replies:
    1
    Views:
    555
    Mike Moore [MSFT]
    Nov 12, 2003
  2. Jon Maz
    Replies:
    4
    Views:
    1,261
    Jon Maz
    Sep 9, 2004
  3. Maxwell2006
    Replies:
    5
    Views:
    2,387
    Steven Cheng[MSFT]
    Mar 7, 2006
  4. John Bentley
    Replies:
    14
    Views:
    345
    Jim Ley
    Feb 5, 2004
  5. VK
    Replies:
    4
    Views:
    351
    Thomas 'PointedEars' Lahn
    Jan 12, 2006
Loading...

Share This Page