Hidden Form Objects and asp

Discussion in 'Javascript' started by David, Sep 18, 2007.

  1. David

    David Guest

    Hi,

    I have an addition I would like to make to an asp web form I have.

    On the form, I have a field which the user inputs a 'quantity' of
    guests.
    If this field is greater than 0 (zero) (How do I test for this ...
    onLostFocus ??), I have a row of fields required for each guest.

    i.e

    First Name | Last Name | Age | Room Type | ....... etc

    The fields are the same for each guest, but just named differently.

    Guest qty = 3

    Then 3 rows of fields should display, or if they are halfway through
    filling them in and wish to add/remove a row of fields, there needs to
    be an option for that also, Delete / Add Guest button ?

    If this can be done, how are the fields named, as the form info needs
    to be sent via email.
    With my asp pages, I am using Request.form("Text_Field_Name"), but
    should they be dynamic names ??

    Or are for example, 10 rows created and all fields named separately,
    but only the specified number are set to display,
    i.e. 3 are shown to the user and 7 are hidden ?

    I would appreciate any help/advice you can offer

    Thanks

    David
    David, Sep 18, 2007
    #1
    1. Advertising

  2. David wrote:
    > I have an addition I would like to make to an asp web form I have.
    >
    > On the form, I have a field which the user inputs a 'quantity' of
    > guests.
    > If this field is greater than 0 (zero) (How do I test for this ...
    > onLostFocus ??), I have a row of fields required for each guest.
    >
    > i.e
    >
    > First Name | Last Name | Age | Room Type | ....... etc
    >
    > The fields are the same for each guest, but just named differently.
    >
    > Guest qty = 3


    That is neither JScript nor JScript .NET. Probably it is C#.

    > [...]
    > I would appreciate any help/advice you can offer


    Try the newsgroups

    microsoft.public.dotnet.framework.aspnet
    microsoft.public.dotnet.languages.csharp

    instead.


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
    Thomas 'PointedEars' Lahn, Sep 18, 2007
    #2
    1. Advertising

  3. David

    David Guest

    This is JavaScript !

    I need to know how to take a number value entered into my form text
    box (lost focus), which then displays from 1 to 15 rows of identical
    fields, which have already been set up in the form within DIV
    containers.
    When any rows are displayed, I need a text or button option to Remove
    or Add Guest (basically, to clear the current guest if to hide,
    otherwise to leave as is and reveal another row guest


    David

    -------------------------------------------------------------------------------



    On 18 Sep, 11:09, Thomas 'PointedEars' Lahn <>
    wrote:
    > David wrote:
    > > I have an addition I would like to make to an asp web form I have.

    >
    > > On the form, I have a field which the user inputs a 'quantity' of
    > > guests.
    > > If this field is greater than 0 (zero) (How do I test for this ...
    > > onLostFocus ??), I have a row of fields required for each guest.

    >
    > > i.e

    >
    > > First Name | Last Name | Age | Room Type | ....... etc

    >
    > > The fields are the same for each guest, but just named differently.

    >
    > > Guest qty = 3

    >
    > That is neither JScript nor JScript .NET. Probably it is C#.
    >
    > > [...]
    > > I would appreciate any help/advice you can offer

    >
    > Try the newsgroups
    >
    > microsoft.public.dotnet.framework.aspnet
    > microsoft.public.dotnet.languages.csharp
    >
    > instead.
    >
    > PointedEars
    > --
    > Anyone who slaps a 'this page is best viewed with Browser X' label on
    > a Web page appears to be yearning for the bad old days, before the Web,
    > when you had very little chance of reading a document written on another
    > computer, another word processor, or another network. -- Tim Berners-Lee
    David, Sep 18, 2007
    #3
  4. David top-posted:

    http://www.jibbering.com/faq/faq_notes/clj_posts.html

    [Quotation repaired:]

    > On 18 Sep, 11:09, Thomas 'PointedEars' Lahn <>
    > wrote:
    >> David wrote:
    >>> I have an addition I would like to make to an asp web form I have.
    >>> On the form, I have a field which the user inputs a 'quantity' of
    >>> guests.
    >>> If this field is greater than 0 (zero) (How do I test for this ...
    >>> onLostFocus ??), I have a row of fields required for each guest.
    >>> i.e
    >>> First Name | Last Name | Age | Room Type | ....... etc
    >>> The fields are the same for each guest, but just named differently.
    >>> Guest qty = 3

    >> That is neither JScript nor JScript .NET. Probably it is C#.
    >>
    >>> [...]
    >>> I would appreciate any help/advice you can offer

    >> Try the newsgroups
    >>
    >> microsoft.public.dotnet.framework.aspnet
    >> microsoft.public.dotnet.languages.csharp

    >
    > This is JavaScript !


    That's unlikely with ASP(.NET). It may be client-side JScript,
    though. Still, posting to the ASP.NET group or any of
    microsoft.public.inetserver.asp.* is probably not a bad idea.

    > I need to know how to take a number value entered into my form text
    > box (lost focus), which then displays from 1 to 15 rows of identical
    > fields, which have already been set up in the form within DIV
    > containers.


    function handleChange(o)
    {
    for (var i = 0, len = +o.value; i < len; i++)
    {
    divs.style.display = "block";
    }
    }

    <input ... onchange="handleChange(this)">

    The usual feature tests should be applied.

    > When any rows are displayed, I need a text or button option to Remove
    > or Add Guest (basically, to clear the current guest if to hide,
    > otherwise to leave as is and reveal another row guest


    <div id="...">
    ...
    <input type="button" value="Remove Guest" onclick="removeGuest(this)">
    <input type="button" value="Add Guest" onclick="addGuest(this)">
    </div>


    http://www.w3.org/DOM/
    http://developer.mozilla.org/en/docs/DOM
    http://msdn2.microsoft.com/en-us/library/ms533050.aspx

    Watch for graceful degradation.


    HTH

    PointedEars
    --
    Prototype.js was written by people who don't know javascript for people
    who don't know javascript. People who don't know javascript are not
    the best source of advice on designing systems that use javascript.
    -- Richard Cornford, cljs, <f806at$ail$1$>
    Thomas 'PointedEars' Lahn, Sep 18, 2007
    #4
    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. Rick
    Replies:
    3
    Views:
    8,092
    Alexey Smirnov
    Apr 13, 2010
  2. GavMc
    Replies:
    4
    Views:
    311
    Evertjan.
    Sep 22, 2005
  3. Craig Anderson

    Accessing hidden objects in a form

    Craig Anderson, Jul 2, 2004, in forum: Javascript
    Replies:
    5
    Views:
    130
    Grant Wagner
    Jul 13, 2004
  4. Mark Hannon
    Replies:
    3
    Views:
    171
    Randy Webb
    Sep 3, 2004
  5. SolarCanine
    Replies:
    2
    Views:
    251
    SolarCanine
    Sep 20, 2005
Loading...

Share This Page