I figured it out. i was finally able to locate some sample code online that
changes it to a red color when the value changes. I still don't know how to
make it display a message such as "Value changed". I have a popup menu that
appears, but that doesn't seem efficient and probably aggravating. It's
weird how there seems to be a difficult and an easy way of doing things in
javascript.

echo "<input value='$streetnumber' name='txtStreetNumber' onchange='if
(this.value!=this.defaultValue) { fieldChanged(this) }'>";


function fieldChanged(val)
{
val.style.background='#FF0000'; //gives the background a red color
alert ("This field has changed its value. If you do not wish to save, please
exit the page");
}

On Tue, Mar 23, 2010 at 10:34 PM, Grant <gspol...@gmail.com> wrote:

> Correction..my code is this...
>
> echo "<p>Street Number:<input type='text' name='txtStreetNumber'
> value='$streetnumber' size='20' onchange='if(this.value !=
> 'txtStreetNumber') document.getElementById('chnge').style.display=''; else
> document.getElementById('chnge').style.display='none';'>
> <span id='chnge' style='display:none;'>VALUE CHANGED</span>";
>
> I keep getting an error message in my javascript. If anyone has a better
> suggestion for a dirty event, please let me know.
>
> Grant
>
>   On Tue, Mar 23, 2010 at 10:32 PM, Grant <gspol...@gmail.com> wrote:
>
>> Thank you, but I'm sorry. I don't understand your correction.
>>
>> Here is my code.
>>
>> echo "<p>Street Number:<input type='text' name='txtStreetNumber'
>> value='$streetnumber' size='20' onchange='if(this.value != '$MLSNumber')
>> document.getElementById('chnge').style.display=''; else
>> document.getElementById('chnge').style.display='none';'>
>> <span id='chnge' style='display:none;'>VALUE CHANGED</span>";
>> Thanks,
>> Grant
>>   On Tue, Mar 23, 2010 at 10:12 PM, birgunj birgunj <
>> birgunjp0...@yahoo.com> wrote:
>>
>>>
>>>
>>> in javascript user
>>>
>>> this.value !=''aaaaaaaa'
>>>
>>> --- On Tue, 3/23/10, Grant <gspol...@gmail.com <gspollet%40gmail.com>>
>>> wrote:
>>>
>>> From: Grant <gspol...@gmail.com <gspollet%40gmail.com>>
>>> Subject: Re: [php_mysql] How to read value in edited text
>>> To: php_mysql@yahoogroups.com <php_mysql%40yahoogroups.com>
>>> Date: Tuesday, March 23, 2010, 8:20 AM
>>>
>>>
>>> Hello,
>>>
>>> How do I read the value from an edited input text? I know how to make the
>>> text input retrieve the value from a Mysql database.
>>>
>>> <p>Street Number:<input type='text' name='txtStreetNumber'
>>> value='$streetnumber' size='20' onfocus='changeColorOnFocus(this)'
>>> onblur='changeColorOffFocus(this)'></p>
>>>
>>> This would display a text field such as:
>>> Street Number: [ Text box is here]
>>>
>>> However, how can my form identify when the text input has been altered? I
>>> believe this is considered a "dirty" event. My goal is to print a short
>>> message next to the text box that says "Value changed" so that the user
>>> can
>>> know which fields were changed BEFORE he hits submit to run the Update
>>> query. This would allow any mistakes to be canceled. Ideally, I'd like
>>> some
>>> some of event to also identify when a form was changed and not saved
>>> BEFORE
>>> leaving the current page.
>>>
>>> For example:
>>> Street Number; [Text box is here] "Value changed!"
>>>
>>> I simply want to use an If Statement to compare the current value to the
>>> new
>>> value.
>>>
>>> if (txtStreetNumber != ????????)
>>> { echo "Value changed";}
>>>
>>> I found javascript online, but none of it seems to work. I also tried the
>>> "onchange" event since it can recognize when a field is changed and loses
>>> focus. But that also does not seem to work, and I've never used this
>>> event
>>> before.
>>>
>>> Thanks,
>>> Grant
>>>
>>> On Fri, Mar 19, 2010 at 6:21 AM, webmaster_bmw <
>>> greg.sm...@uksites4all.co.uk <greg.smith%40uksites4all.co.uk>
>>> > wrote:
>>>
>>> >
>>> >
>>> > No posts since October 2009....
>>> >
>>> > Anyone out there?
>>> >
>>> >
>>> >
>>>
>>> [Non-text portions of this message have been removed]
>>>
>>> ------------------------------------
>>>
>>> The php_mysql group is dedicated to learn more about the PHP/MySQL web
>>> database possibilities through group learning. Yahoo! Groups Links
>>>
>>>
>>> [Non-text portions of this message have been removed]
>>>
>>>   
>>>
>>
>>
>>
>>  --
>> Grant S. Pollet, REALTOR
>> Austin TX
>>
>
>
>
> --
> Grant S. Pollet, REALTOR
> Austin TX
>



-- 
Grant S. Pollet, REALTOR
Austin TX


[Non-text portions of this message have been removed]



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

The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning. Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php_mysql/join
    (Yahoo! ID required)

<*> To change settings via email:
    php_mysql-dig...@yahoogroups.com 
    php_mysql-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    php_mysql-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to