How can I know the user has updated an input form feild item?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: How can I know the user has updated an input form feild item?

  1. #1
    amy Guest

    How can I know the user has updated an input form feild item?


    I have a form that allows the user to update information.I want to update
    the information against the database table only if the user updates the text
    in the form feild.
    How can I do this?

    Thanks in advance.

  2. #2
    Russell Jones Guest

    Re: How can I know the user has updated an input form feild item?

    There are several ways; here's one that doesn't require Session variables,
    is easy to set up, and the logic will work in any browser, with any server
    scriptihng technology, and on any platform. I've used ASP syntax as an
    example.

    On the server, in the page that creates the form, create a set of hidden
    input fields that parallel the input controls. The hidden fields hold the
    original values. For example, assume you have the field "lastname" in an ADO
    Recordset object (rs) retrieved from your database. You might write:

    <input type="hidden" name="original_lastname"
    value="<%=rs("lastname").value%>">
    <input type="text" name="lastname" value="<%=rs("lastname").value%>">

    Now, when the user posts back the form, you'll be able
    to compare the original_lastname value with the lastname value to see if the
    user
    altered the text.



    The client will post both these hidden original values
    "amy" <ohblimp@aol.com> wrote in message news:3a689f33$1@news.devx.com...
    >
    > I have a form that allows the user to update information.I want to update
    > the information against the database table only if the user updates the

    text
    > in the form feild.
    > How can I do this?
    >
    > Thanks in advance.




  3. #3
    Kyle Guest

    Re: How can I know the user has updated an input form feild item?


    "amy" <ohblimp@aol.com> wrote:
    >
    >I have a form that allows the user to update information.I want to update
    >the information against the database table only if the user updates the

    text
    >in the form feild.
    >How can I do this?
    >
    >Thanks in advance.


    I am assuming you are using ASP. If this is the case, try this:

    (VBScript)
    If request.form(fieldname).value <> "" Then
    'trigger your SQL update
    Else
    'move on to soemthing else
    End If

    If you are using something else, just trigger your SQL update off the submit
    value of the Text Box.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center