SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Jul 2000
    Location
    Walsall, West Midlands, United Kingdom
    Posts
    259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting number of Text fields on the fly

    Hi,

    I'm looking for some suggestions please for the following:

    I have a webpage which contains a text field so a user can enter a quantity. However, depending on whose account I use the number of items to buy changes depending on what is available, therefore the number of text fields in the page are different between the accounts.

    What I want to do is to get the number of text fields shown on this page on the fly, and then use that to enter data in the relevant boxes, etc. etc.

    Can anyone help?

    Cheers,

    Paul.

  2. #2
    Junior Member
    Join Date
    Mar 2001
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting number of Text fields on the fly

    If the text fields are all in the same frame, you can use GetChildren( ) and GetClass( ) methods.

    This is the rough idea:

    list of windows mywindows = frame.GetChildren

    for each window in mywindows
    if window.GetClass == HTMLTextfield
    textfieldcount++

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting number of Text fields on the fly

    The easiest way is to do this:

    check for HtmlTextField by ID# until you get exception

    [This message has been edited by GodKnows (edited 03-14-2001).]

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Location
    Walsall, West Midlands, United Kingdom
    Posts
    259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting number of Text fields on the fly

    Cheers guys for your replies.

    Dave, I couldn't get your solution to work properly with GetClass(), however because GetChildren is used, I then searched the result of GetChildren for HtmlTextField and for each instance incremented a counter which works great.

    Godknows, your solution works better within a 'while' condition instead of 'if' and therefore no need to use do..except (unless I've overlooked something).

    They both work well, so don't know what to opt for just yet.

    Once again, cheers for your help.


    Paul.

    [This message has been edited by Beeblemaster (edited 03-15-2001).]

  5. #5
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting number of Text fields on the fly

    Beeblemaster:

    My code was intented to work with a while loop just forgot to put it there:P Otherwise the counter would not make too much sense.

    For clean code go with the GetChildren().

    For faster code(in theory) go with mine since I don't loop through all the control from a window(what if there are alot).


    Good Luck



    [This message has been edited by GodKnows (edited 03-15-2001).]

 

 

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:21 PM.

Copyright BetaSoft Inc.