recognize the change of controls value in javascript

R

raha

hi.
Is there any body to help me?
I am writing a web program.
I have some forms.
each form have some controls and users can edit the controls.
finally they can save their forms.
I would like to add an ability to my program.
In fact I want to have an Icon that change, when a user change the
value of a control of form such as textbox , radiobox, grid.
as you know the most famous and important editors such as PSPAD or
MSWORD have this ability.
I want to write my code with javascript and I wouldn't like to work
with the server.
In fact all the story happen at the clients side.
I think that checking the Control's value with values of Database or a
copy of database that exist in memory in the specific time is not a
good way.
 
D

Darko

hi.
Is there any body to help me?
I am writing a web program.
I have some forms.
each form have some controls and users can edit the controls.
finally they can save their forms.
I would like to add an ability to my program.
In fact I want to have an Icon that change, when a user change the
value of a control of form such as textbox , radiobox, grid.
as you know the most famous and important editors such as PSPAD or
MSWORD have this ability.
I want to write my code with javascript and I wouldn't like to work
with the server.
In fact all the story happen at the clients side.
I think that checking the Control's value with values of Database or a
copy of database that exist in memory in the specific time is not a
good way.

Maybe using the onchange event on the inputs?
 
R

Randy Webb

Darko said the following on 6/20/2007 1:58 PM:
Maybe using the onchange event on the inputs?

That won't satisfy the desire though. If an input starts with a value of
"Default Value" and I manually change it to "Manual Value", then I
change my mind and type in "Default Value", did the value of the input
change? defaultValue is the property wanted to check against, not simply
that the value has changed.

onchange="if(this.value!=this.defaultValue){changeTheIcon('changed'}else{changeTheIcon('default')}"

And then have changeTheIcon change the icon dependent on the parameter
passed to it.
 
D

Darko

Darko said the following on 6/20/2007 1:58 PM:





That won't satisfy the desire though. If an input starts with a value of
"Default Value" and I manually change it to "Manual Value", then I
change my mind and type in "Default Value", did the value of the input
change? defaultValue is the property wanted to check against, not simply
that the value has changed.

onchange="if(this.value!=this.defaultValue){changeTheIcon('changed'}else{changeTheIcon('default')}"

And then have changeTheIcon change the icon dependent on the parameter
passed to it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

And if you open MS Word and find the text "Default text" and then you
change it to "Modified text" and then manually back to "Default text"
do you think it will consider the document modified or not?
 
R

Randy Webb

Darko said the following on 6/21/2007 11:15 AM:
And if you open MS Word and find the text "Default text" and then you
change it to "Modified text" and then manually back to "Default text"
do you think it will consider the document modified or not?

Let me think on this one for a minute and consider a few things:

1) This is a Javascript Newsgroup
2) This newsgroup has nothing to do with MS Word.
3) I don't use MS Word, I use a real Word Processor.
4) What happens in Word has nothing to do with what happens in a browser
unless you are trying to emulate it.
5) I didn't change my mind after thinking about it, I still don't care
what MS Word does. If you want to know if a field has changed from it's
default value then onchange alone will not suffice.
 
D

Darko

Let me think on this one for a minute and consider a few things:

1) This is a Javascript Newsgroup
2) This newsgroup has nothing to do with MS Word.
3) I don't use MS Word, I use a real Word Processor.
4) What happens in Word has nothing to do with what happens in a browser
unless you are trying to emulate it.
5) I didn't change my mind after thinking about it, I still don't care
what MS Word does. If you want to know if a field has changed from it's
default value then onchange alone will not suffice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,886
Members
47,419
Latest member
ArturoBres

Latest Threads

Top