-
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.
-
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.
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks