SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting MaxLenght of an HTMLTextField

    Is there a way to get the Maxium number of characters a HTML Text field will allow? Basically, I am looking for a SilkTest function that will read the MaxLenght property of the HTML object and return that value, or something saying there is no MaxLenght set.

    The reason I am looking for this is to do quick field lenght limit testings of forms and comparing that with the limit set for the database field.



    ------------------
    David Genrich
    Icarian
    555 North Mathilda Ave
    Sunnyvale, CA 94086
    davidg@icarian.com

  2. #2
    Junior Member
    Join Date
    Nov 1999
    Location
    Chicago, IL USA
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting MaxLenght of an HTMLTextField

    As far as I know, there's no method like what you described, but I've done a test similar to this, and took a different tack on it.

    I took the database length (iDBLen) and used TextField.SetText(Replicate("0",iDBLen)). Then I verified that Len(TextField.GetText()) = iDBLen.

    I used zero as my character that way i didn't care whether the field was numeric or alphanumeric, but you could make the character to repeat a variable based on the database definition.

    You should also be concerned about testing the field for whether it's multi-text or not since the Get and Set methods will be different.

  3. #3
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting MaxLenght of an HTMLTextField

    I actually made a function last night that does just what you mentioned. I used the TypeKeys() function so it works on both a muti-text line and single line. The GetText() method works on both. I also clear the fields before adding the string length (which I use 3 times the maxium length for that field), then clear the field again after doing the GetText.

    Made it nice to add to the bug report exactly which fields were wrong and how they were wrong.



    ------------------
    David Genrich
    Icarian
    555 North Mathilda Ave
    Sunnyvale, CA 94086
    davidg@icarian.com

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:16 AM.

Copyright BetaSoft Inc.