How do I check for changes in a user form?

Discussion in 'ASP .Net' started by Casper Skovgaard, May 6, 2004.

  1. I have a form with several fields (textbox, radio, checkbox), when the user
    submits the form I want to check if the user have changed anything.

    The check should be performed in the code-behind file.

    Is this possible?


    /Casper
     
    Casper Skovgaard, May 6, 2004
    #1
    1. Advertising

  2. Casper Skovgaard

    avnrao Guest

    if you want to check using Request.Form[""], you cannot access the default
    value.
    If you want to perform this check only for server controls, you can have
    Changed event handlers for all controls.

    for html controls, you have to perform the check on the client side using
    script.

    Av.

    "Casper Skovgaard" <> wrote in message
    news:Xns94E164DA7A3FDcasperskovgaardhotma@207.46.248.16...
    >I have a form with several fields (textbox, radio, checkbox), when the user
    > submits the form I want to check if the user have changed anything.
    >
    > The check should be performed in the code-behind file.
    >
    > Is this possible?
    >
    >
    > /Casper
     
    avnrao, May 6, 2004
    #2
    1. Advertising

  3. I only need to check for server controls. I have tried to do the
    following:

    On the controls I have added a OnTextChanged
    <asp:textbox OnTextChanged="OnDocumentChanged"....

    And created this method in the code-behind file
    private bool IsDocumentChanged;

    protected void OnDocumentChanged(object src, EventArgs e)
    {
    // event handler for all input fields
    IsDocumentChanged = true;
    }

    The problem with that solution is that OnDocumentChanged is first
    executed after Page_Load. I need to do one thing when then input is
    changed and another thing if the input is not changed. I can't see how to
    do that???

    /Casper

    "avnrao" <> wrote in
    news::

    > if you want to check using Request.Form[""], you cannot access the
    > default value.
    > If you want to perform this check only for server controls, you can
    > have Changed event handlers for all controls.
    >
    > for html controls, you have to perform the check on the client side
    > using script.
    >
    > Av.
    >
    > "Casper Skovgaard" <> wrote in message
    > news:Xns94E164DA7A3FDcasperskovgaardhotma@207.46.248.16...
    >>I have a form with several fields (textbox, radio, checkbox), when the
    >>user
    >> submits the form I want to check if the user have changed anything.
    >>
    >> The check should be performed in the code-behind file.
    >>
    >> Is this possible?
    >>
    >>
    >> /Casper

    >
    >
    >
     
    Casper Skovgaard, May 6, 2004
    #3
  4. Casper Skovgaard

    Rick Spiewak Guest

    Check for postback in your event handler first, don't set IsDocumentChanged
    unless it is a postback.

    "Casper Skovgaard" <> wrote in message
    news:Xns94E175D6E41CFcasperskovgaardhotma@207.46.248.16...
    > I only need to check for server controls. I have tried to do the
    > following:
    >
    > On the controls I have added a OnTextChanged
    > <asp:textbox OnTextChanged="OnDocumentChanged"....
    >
    > And created this method in the code-behind file
    > private bool IsDocumentChanged;
    >
    > protected void OnDocumentChanged(object src, EventArgs e)
    > {
    > // event handler for all input fields
    > IsDocumentChanged = true;
    > }
    >
    > The problem with that solution is that OnDocumentChanged is first
    > executed after Page_Load. I need to do one thing when then input is
    > changed and another thing if the input is not changed. I can't see how to
    > do that???
    >
    > /Casper
    >
    > "avnrao" <> wrote in
    > news::
    >
    > > if you want to check using Request.Form[""], you cannot access the
    > > default value.
    > > If you want to perform this check only for server controls, you can
    > > have Changed event handlers for all controls.
    > >
    > > for html controls, you have to perform the check on the client side
    > > using script.
    > >
    > > Av.
    > >
    > > "Casper Skovgaard" <> wrote in message
    > > news:Xns94E164DA7A3FDcasperskovgaardhotma@207.46.248.16...
    > >>I have a form with several fields (textbox, radio, checkbox), when the
    > >>user
    > >> submits the form I want to check if the user have changed anything.
    > >>
    > >> The check should be performed in the code-behind file.
    > >>
    > >> Is this possible?
    > >>
    > >>
    > >> /Casper

    > >
    > >
    > >

    >
     
    Rick Spiewak, May 6, 2004
    #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. Vinay
    Replies:
    1
    Views:
    449
    John Saunders
    Sep 27, 2003
  2. Vinay
    Replies:
    0
    Views:
    376
    Vinay
    Sep 29, 2003
  3. JIK

    Check for form changes

    JIK, Feb 6, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    571
  4. Assimalyst

    Check form before unload for changes

    Assimalyst, Aug 10, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,417
    Assimalyst
    Aug 11, 2005
  5. Mad Scientist Jr
    Replies:
    0
    Views:
    639
    Mad Scientist Jr
    Mar 22, 2006
Loading...

Share This Page