PC Review


Reply
Thread Tools Rate Thread

Client side changes not reflected in page

 
 
=?Utf-8?B?cGF0cmlja2RyZA==?=
Guest
Posts: n/a
 
      1st Feb 2007
Hi everyone!

I have a hidden input field in a form which I change in some occasions on
the client using javascript,
but when I use "view source" I can't see these changes reflected on the page!

Does anyone know what I should do in order for the page to know the change?
(Tried with enableviewstate=false, true, whatever, didn't work)

I would like to have the change reflected in the page without doing a
postback or on the postback!

Is this possible? Thanks in advance!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      1st Feb 2007
Stick this in the browser addressbar and you'll see the changes:
javascript:document.write("<xmp>"+document.documentElement.innerHTML+
"</xmp>");

Dynamic updates to the HTML DOM don't usually show up with "View Source".
Peter


--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




"patrickdrd" wrote:

> Hi everyone!
>
> I have a hidden input field in a form which I change in some occasions on
> the client using javascript,
> but when I use "view source" I can't see these changes reflected on the page!
>
> Does anyone know what I should do in order for the page to know the change?
> (Tried with enableviewstate=false, true, whatever, didn't work)
>
> I would like to have the change reflected in the page without doing a
> postback or on the postback!
>
> Is this possible? Thanks in advance!

 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      1st Feb 2007
view source shows what the server sent, not the current state of the
page. if javascript changed anything it is not reflected in the source.

for example view source of this page looks nothing like the rendered html:

<html>
<body>
<script>
for(var i=0; i< 100; ++i) document.write('hello ' + i + '<br>');
</script>
</body>
</html>


-- bruce (sqlwork.com)


patrickdrd wrote:
> Hi everyone!
>
> I have a hidden input field in a form which I change in some occasions on
> the client using javascript,
> but when I use "view source" I can't see these changes reflected on the page!
>
> Does anyone know what I should do in order for the page to know the change?
> (Tried with enableviewstate=false, true, whatever, didn't work)
>
> I would like to have the change reflected in the page without doing a
> postback or on the postback!
>
> Is this possible? Thanks in advance!

 
Reply With Quote
 
=?Utf-8?B?cGF0cmlja2RyZA==?=
Guest
Posts: n/a
 
      1st Feb 2007
Yes, but when the page is posted back to the server,
the change that javascript made isn't recognized by the server code,
while the server recognizes changes made through user input,
it doesn't know changes made by javascript! Why?

"Peter Bromberg [C# MVP]" wrote:

> Stick this in the browser addressbar and you'll see the changes:
> javascript:document.write("<xmp>"+document.documentElement.innerHTML+
> "</xmp>");
>
> Dynamic updates to the HTML DOM don't usually show up with "View Source".
> Peter
>
>
> --
> Site: http://www.eggheadcafe.com
> UnBlog: http://petesbloggerama.blogspot.com
> Short urls & more: http://ittyurl.net
>
>
>
>
> "patrickdrd" wrote:
>
> > Hi everyone!
> >
> > I have a hidden input field in a form which I change in some occasions on
> > the client using javascript,
> > but when I use "view source" I can't see these changes reflected on the page!
> >
> > Does anyone know what I should do in order for the page to know the change?
> > (Tried with enableviewstate=false, true, whatever, didn't work)
> >
> > I would like to have the change reflected in the page without doing a
> > postback or on the postback!
> >
> > Is this possible? Thanks in advance!

 
Reply With Quote
 
=?Utf-8?B?cGF0cmlja2RyZA==?=
Guest
Posts: n/a
 
      1st Feb 2007
Yes, but when the page is posted back to the server,
the change that javascript made isn't recognized by the server code,
while the server recognizes changes made through user input,
it doesn't know changes made by javascript! Why?


"bruce barker" wrote:

> view source shows what the server sent, not the current state of the
> page. if javascript changed anything it is not reflected in the source.
>
> for example view source of this page looks nothing like the rendered html:
>
> <html>
> <body>
> <script>
> for(var i=0; i< 100; ++i) document.write('hello ' + i + '<br>');
> </script>
> </body>
> </html>
>
>
> -- bruce (sqlwork.com)
>
>
> patrickdrd wrote:
> > Hi everyone!
> >
> > I have a hidden input field in a form which I change in some occasions on
> > the client using javascript,
> > but when I use "view source" I can't see these changes reflected on the page!
> >
> > Does anyone know what I should do in order for the page to know the change?
> > (Tried with enableviewstate=false, true, whatever, didn't work)
> >
> > I would like to have the change reflected in the page without doing a
> > postback or on the postback!
> >
> > Is this possible? Thanks in advance!

>

 
Reply With Quote
 
Thomas Hansen
Guest
Posts: n/a
 
      1st Feb 2007
On Feb 1, 2:34 am, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.com> wrote:
> Stick this in the browser addressbar and you'll see the changes:
> javascript:document.write("<xmp>"+document.documentElement.innerHTML+
> "</xmp>");


[try to avoid "top posting"... ]

Or you could use FireFox together with FireBug from which you have the
possibility to both INSPECT the DOM in addition to actually do CHANGES
to the DOM and CSS in addition to setting breakpoints in JavaScript
code...
Marvelous tool
I LOVE FireBug!!


..t

--
http://ajaxwidgets.com
Free ASP.NET Ajax Widgets NOW!

 
Reply With Quote
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      1st Feb 2007
It seems to me that Bruce's response was quite explanatory, read it again for
the answer.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




"patrickdrd" wrote:

> Yes, but when the page is posted back to the server,
> the change that javascript made isn't recognized by the server code,
> while the server recognizes changes made through user input,
> it doesn't know changes made by javascript! Why?
>
>
> "bruce barker" wrote:
>
> > view source shows what the server sent, not the current state of the
> > page. if javascript changed anything it is not reflected in the source.
> >
> > for example view source of this page looks nothing like the rendered html:
> >
> > <html>
> > <body>
> > <script>
> > for(var i=0; i< 100; ++i) document.write('hello ' + i + '<br>');
> > </script>
> > </body>
> > </html>
> >
> >
> > -- bruce (sqlwork.com)
> >
> >
> > patrickdrd wrote:
> > > Hi everyone!
> > >
> > > I have a hidden input field in a form which I change in some occasions on
> > > the client using javascript,
> > > but when I use "view source" I can't see these changes reflected on the page!
> > >
> > > Does anyone know what I should do in order for the page to know the change?
> > > (Tried with enableviewstate=false, true, whatever, didn't work)
> > >
> > > I would like to have the change reflected in the page without doing a
> > > postback or on the postback!
> > >
> > > Is this possible? Thanks in advance!

> >

 
Reply With Quote
 
=?Utf-8?B?cGF0cmlja2RyZA==?=
Guest
Posts: n/a
 
      1st Feb 2007
Well, ok, forget about the page's source,
my mistake mentioning this,
my real problem is that the variable show its 'original' value when
submitted to the server and not the one that javascript changed to!
Why isn't that variable/field 'refreshed'?
Do I need to do something (like a 'refresh')?

"Peter Bromberg [C# MVP]" wrote:

> It seems to me that Bruce's response was quite explanatory, read it again for
> the answer.
> Peter
>
> --
> Site: http://www.eggheadcafe.com
> UnBlog: http://petesbloggerama.blogspot.com
> Short urls & more: http://ittyurl.net
>
>
>
>
> "patrickdrd" wrote:
>
> > Yes, but when the page is posted back to the server,
> > the change that javascript made isn't recognized by the server code,
> > while the server recognizes changes made through user input,
> > it doesn't know changes made by javascript! Why?
> >
> >
> > "bruce barker" wrote:
> >
> > > view source shows what the server sent, not the current state of the
> > > page. if javascript changed anything it is not reflected in the source.
> > >
> > > for example view source of this page looks nothing like the rendered html:
> > >
> > > <html>
> > > <body>
> > > <script>
> > > for(var i=0; i< 100; ++i) document.write('hello ' + i + '<br>');
> > > </script>
> > > </body>
> > > </html>
> > >
> > >
> > > -- bruce (sqlwork.com)
> > >
> > >
> > > patrickdrd wrote:
> > > > Hi everyone!
> > > >
> > > > I have a hidden input field in a form which I change in some occasions on
> > > > the client using javascript,
> > > > but when I use "view source" I can't see these changes reflected on the page!
> > > >
> > > > Does anyone know what I should do in order for the page to know the change?
> > > > (Tried with enableviewstate=false, true, whatever, didn't work)
> > > >
> > > > I would like to have the change reflected in the page without doing a
> > > > postback or on the postback!
> > > >
> > > > Is this possible? Thanks in advance!
> > >

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      1st Feb 2007
"patrickdrd" <(E-Mail Removed)> wrote in message
news:FF279E8C-84A8-489A-9B46-(E-Mail Removed)...

Patrick,

> Well, ok, forget about the page's source,
> my mistake mentioning this,


It's a common misconception... :-)

> my real problem is that the variable show its 'original' value when
> submitted to the server and not the one that javascript changed to!
> Why isn't that variable/field 'refreshed'?
> Do I need to do something (like a 'refresh')?


This, however, is a different issue...

Client-side data changes, whether caused by user typing or JavaScript,
should certainly survive a postback.

You'll need to post your code...


 
Reply With Quote
 
=?Utf-8?B?cGF0cmlja2RyZA==?=
Guest
Posts: n/a
 
      1st Feb 2007
I've had the exact problem both in ASP.NET 1.1 and now I'm facing it in 2.0
as well!

Well, the case is this
(I'll mention the 1.1 case, which is easier to tell):

on a user input form (data entry - update a customer, let's say),
the user types the new data and presses the update button to commit the
changes,
however, javascript is called before the postback in order to validate the
input values,
if something goes wrong prompts the user to correct,
and, when everything is ok, posts the page to the server.

If I change a single value on a single field with javascript on this example
and then post back the page to the server, that change can't be seen by the
server,
while user values and changes of the fields can!

Why? How is that?

"Mark Rae" wrote:

> "patrickdrd" <(E-Mail Removed)> wrote in message
> news:FF279E8C-84A8-489A-9B46-(E-Mail Removed)...
>
> Patrick,
>
> > Well, ok, forget about the page's source,
> > my mistake mentioning this,

>
> It's a common misconception... :-)
>
> > my real problem is that the variable show its 'original' value when
> > submitted to the server and not the one that javascript changed to!
> > Why isn't that variable/field 'refreshed'?
> > Do I need to do something (like a 'refresh')?

>
> This, however, is a different issue...
>
> Client-side data changes, whether caused by user typing or JavaScript,
> should certainly survive a postback.
>
> You'll need to post your code...
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET Listbox Client Side changes not reflected on page chandru Microsoft ASP .NET 1 20th Jul 2007 04:32 PM
Safe to have client-side AND server-side page load event procedures? Fred Microsoft ASP .NET 2 12th Jul 2004 07:46 PM
Execute client side jscript on page load based on server side logic moondaddy Microsoft ASP .NET 2 18th Mar 2004 01:33 PM
Adding custom client-side onClick handler with client-side validator controls Zoe Hart Microsoft ASP .NET 1 8th Jan 2004 10:45 PM
client side scripting changes to be reflected back to server Sumit Microsoft ASP .NET 1 16th Oct 2003 05:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:27 PM.