Value not gettin gwrittne to the DOM.

R

ravi

Hi,

I am a newbie to javascript.

Iam working on a page that has two radio buttons and a tree. I do not
have my tree nodes to be selectable.
Iam working on Firefox.
I have the firebug debugger attached.
Actually this is about a problem iam trying to debug. And found what
the problem is and iam looking for a hack/ workaround to fix the bug.

With one radio button selected and I working on the tree, the values
for actions of tree collapse or tree expand get sent to the server from
my javascript correctly. Before the page is submitted from javascript
to the server, I can see these collapse/ expand values reflected for my
form input elements in the HTML DOM correctly.

When I change the radio button selection, I don't see the collpase/
expand values sent to the server for the form input element. I can
verify the correct values using an alert function in my javascript, but
they are not getting written to the form input in the DOM and so not
seen/(sent to the) on server side too.
(Iam thinking once this 2nd radio button gets processed on the server,
some bad page is returned and thus making the problem show up. But I
don't see the problem with this button when I make my tree nodes
selectable. So iam looking for a hack in the javascript.)

The follwoing Code in my javascript writes the values to the form
input.

actionNameEnc is the name for the form input.
actionValue is the value that takes the values of tree collpase or
expand.
so the actionValue should be assgined to the actionNameEnc and returned
to the server.


<form ......>
<input type="hidden" value="actionNameEnc" name="actionNameEnc"
id="actionNameEnc"/>

<...javascript code....>
form[actionNameEnc].value = actionValue ;
alert(form[actionNameEnc].value); // this shows the correct
runtime value but is not seen in DOM


Can someone please suggest me some hack or workaround to make the value
that i see getting reflected in my javascript correctly to be seen also
in the DOM(value for the html form input) and thus could be sent back
to the server correctly.

Thanks in Advance to all..
Ravi.
 
B

Benjamin

ravi said:
Hi,

I am a newbie to javascript.

Iam working on a page that has two radio buttons and a tree. I do not
have my tree nodes to be selectable.
Iam working on Firefox.
I have the firebug debugger attached.
Actually this is about a problem iam trying to debug. And found what
the problem is and iam looking for a hack/ workaround to fix the bug.

With one radio button selected and I working on the tree, the values
for actions of tree collapse or tree expand get sent to the server from
my javascript correctly. Before the page is submitted from javascript
to the server, I can see these collapse/ expand values reflected for my
form input elements in the HTML DOM correctly.

When I change the radio button selection, I don't see the collpase/
expand values sent to the server for the form input element. I can
verify the correct values using an alert function in my javascript, but
they are not getting written to the form input in the DOM and so not
seen/(sent to the) on server side too.
(Iam thinking once this 2nd radio button gets processed on the server,
some bad page is returned and thus making the problem show up. But I
don't see the problem with this button when I make my tree nodes
selectable. So iam looking for a hack in the javascript.)

The follwoing Code in my javascript writes the values to the form
input.

actionNameEnc is the name for the form input.
actionValue is the value that takes the values of tree collpase or
expand.
so the actionValue should be assgined to the actionNameEnc and returned
to the server.


<form ......>
<input type="hidden" value="actionNameEnc" name="actionNameEnc"
id="actionNameEnc"/>

<...javascript code....>
form[actionNameEnc].value = actionValue ;
alert(form[actionNameEnc].value); // this shows the correct
runtime value but is not seen in DOM


Can someone please suggest me some hack or workaround to make the value
that i see getting reflected in my javascript correctly to be seen also
in the DOM(value for the html form input) and thus could be sent back
to the server correctly.
no workaround needed! You just need to put the var you're assigning a
value to first!

actionValue = form[actionNameEnc].value;
alert(actionValue);

It should work!
 
R

ravi

Hi. thanks for the reply.
that doesn't help. I tried though. logs an error in the log.

May be I was not clear in the problem description.

'actionValue' is the parameter for my javascript function that takes
the rutime value of the tree collapse or expand.
And the paratmeter 'actionNameEnc'(or the form input name) need to be
assigned to this value.

Ravi.
ravi said:
Hi,

I am a newbie to javascript.

Iam working on a page that has two radio buttons and a tree. I do not
have my tree nodes to be selectable.
Iam working on Firefox.
I have the firebug debugger attached.
Actually this is about a problem iam trying to debug. And found what
the problem is and iam looking for a hack/ workaround to fix the bug.

With one radio button selected and I working on the tree, the values
for actions of tree collapse or tree expand get sent to the server from
my javascript correctly. Before the page is submitted from javascript
to the server, I can see these collapse/ expand values reflected for my
form input elements in the HTML DOM correctly.

When I change the radio button selection, I don't see the collpase/
expand values sent to the server for the form input element. I can
verify the correct values using an alert function in my javascript, but
they are not getting written to the form input in the DOM and so not
seen/(sent to the) on server side too.
(Iam thinking once this 2nd radio button gets processed on the server,
some bad page is returned and thus making the problem show up. But I
don't see the problem with this button when I make my tree nodes
selectable. So iam looking for a hack in the javascript.)

The follwoing Code in my javascript writes the values to the form
input.

actionNameEnc is the name for the form input.
actionValue is the value that takes the values of tree collpase or
expand.
so the actionValue should be assgined to the actionNameEnc and returned
to the server.


<form ......>
<input type="hidden" value="actionNameEnc" name="actionNameEnc"
id="actionNameEnc"/>

<...javascript code....>
form[actionNameEnc].value = actionValue ;
alert(form[actionNameEnc].value); // this shows the correct
runtime value but is not seen in DOM


Can someone please suggest me some hack or workaround to make the value
that i see getting reflected in my javascript correctly to be seen also
in the DOM(value for the html form input) and thus could be sent back
to the server correctly.
no workaround needed! You just need to put the var you're assigning a
value to first!

actionValue = form[actionNameEnc].value;
alert(actionValue);

It should work!
Thanks in Advance to all..
Ravi.
 
R

ravi

Can somebody please respond to this question/ problem.
Thank you.
Hi. thanks for the reply.
that doesn't help. I tried though. logs an error in the log.

May be I was not clear in the problem description.

'actionValue' is the parameter for my javascript function that takes
the rutime value of the tree collapse or expand.
And the paratmeter 'actionNameEnc'(or the form input name) need to be
assigned to this value.

Ravi.
ravi said:
Hi,

I am a newbie to javascript.

Iam working on a page that has two radio buttons and a tree. I do not
have my tree nodes to be selectable.
Iam working on Firefox.
I have the firebug debugger attached.
Actually this is about a problem iam trying to debug. And found what
the problem is and iam looking for a hack/ workaround to fix the bug.

With one radio button selected and I working on the tree, the values
for actions of tree collapse or tree expand get sent to the server from
my javascript correctly. Before the page is submitted from javascript
to the server, I can see these collapse/ expand values reflected for my
form input elements in the HTML DOM correctly.

When I change the radio button selection, I don't see the collpase/
expand values sent to the server for the form input element. I can
verify the correct values using an alert function in my javascript, but
they are not getting written to the form input in the DOM and so not
seen/(sent to the) on server side too.
(Iam thinking once this 2nd radio button gets processed on the server,
some bad page is returned and thus making the problem show up. But I
don't see the problem with this button when I make my tree nodes
selectable. So iam looking for a hack in the javascript.)

The follwoing Code in my javascript writes the values to the form
input.

actionNameEnc is the name for the form input.
actionValue is the value that takes the values of tree collpase or
expand.
so the actionValue should be assgined to the actionNameEnc and returned
to the server.


<form ......>
<input type="hidden" value="actionNameEnc" name="actionNameEnc"
id="actionNameEnc"/>

<...javascript code....>
form[actionNameEnc].value = actionValue ;
alert(form[actionNameEnc].value); // this shows the correct
runtime value but is not seen in DOM


Can someone please suggest me some hack or workaround to make the value
that i see getting reflected in my javascript correctly to be seen also
in the DOM(value for the html form input) and thus could be sent back
to the server correctly.
no workaround needed! You just need to put the var you're assigning a
value to first!

actionValue = form[actionNameEnc].value;
alert(actionValue);

It should work!
Thanks in Advance to all..
Ravi.
 
R

ravi

Not resolved yet. Someone Please.
Thank you.
Can somebody please respond to this question/ problem.
Thank you.
Hi. thanks for the reply.
that doesn't help. I tried though. logs an error in the log.

May be I was not clear in the problem description.

'actionValue' is the parameter for my javascript function that takes
the rutime value of the tree collapse or expand.
And the paratmeter 'actionNameEnc'(or the form input name) need to be
assigned to this value.

Ravi.
ravi wrote:
Hi,

I am a newbie to javascript.

Iam working on a page that has two radio buttons and a tree. I do not
have my tree nodes to be selectable.
Iam working on Firefox.
I have the firebug debugger attached.
Actually this is about a problem iam trying to debug. And found what
the problem is and iam looking for a hack/ workaround to fix the bug.

With one radio button selected and I working on the tree, the values
for actions of tree collapse or tree expand get sent to the server from
my javascript correctly. Before the page is submitted from javascript
to the server, I can see these collapse/ expand values reflected for my
form input elements in the HTML DOM correctly.

When I change the radio button selection, I don't see the collpase/
expand values sent to the server for the form input element. I can
verify the correct values using an alert function in my javascript, but
they are not getting written to the form input in the DOM and so not
seen/(sent to the) on server side too.
(Iam thinking once this 2nd radio button gets processed on the server,
some bad page is returned and thus making the problem show up. But I
don't see the problem with this button when I make my tree nodes
selectable. So iam looking for a hack in the javascript.)

The follwoing Code in my javascript writes the values to the form
input.

actionNameEnc is the name for the form input.
actionValue is the value that takes the values of tree collpase or
expand.
so the actionValue should be assgined to the actionNameEnc and returned
to the server.


<form ......>
<input type="hidden" value="actionNameEnc" name="actionNameEnc"
id="actionNameEnc"/>

<...javascript code....>
form[actionNameEnc].value = actionValue ;
alert(form[actionNameEnc].value); // this shows the correct
runtime value but is not seen in DOM


Can someone please suggest me some hack or workaround to make the value
that i see getting reflected in my javascript correctly to be seen also
in the DOM(value for the html form input) and thus could be sent back
to the server correctly.
no workaround needed! You just need to put the var you're assigning a
value to first!

actionValue = form[actionNameEnc].value;
alert(actionValue);

It should work!


Thanks in Advance to all..
Ravi.
 
V

VK

ravi said:
The follwoing Code in my javascript writes the values to the form
input.

actionNameEnc is the name for the form input.
actionValue is the value that takes the values of tree collpase or
expand.
so the actionValue should be assgined to the actionNameEnc and returned
to the server.


<form ......>
<input type="hidden" value="actionNameEnc" name="actionNameEnc"
id="actionNameEnc"/>

<...javascript code....>
form[actionNameEnc].value = actionValue ;
alert(form[actionNameEnc].value); // this shows the correct
runtime value but is not seen in DOM

I'm not clear on what do you mean by "seen in DOM". I hope it doesn't
mean "reflected in page source text" as it is not possible so your
attempt are futile. From what I got (correct me if I'm wrong):

document.forms["myForm"].elements["actionNameEnc"].value = actionValue;
alert (document.forms["myForm"].elements["actionNameEnc"].value);

That's with your form like
<form name="myForm" ....
....
<input type="hidden" name="actionNameEnc">
....
 
R

ravi

Hi. Thanks for the reply.

Iam having the firebug debugger as a plugin for firefox.
this tool shows the HTML DOM representation for the different html
elements of the page source. And shows the runtime values changing for
the html elements as i walk through the debugger.

In my javascript, I can verify the value of the form input Iam
modifying.
This iam able to print it out using the following alert.

window.document.forms[0][actionNameEnc].value = actionValue;
alert(window.document.forms[0][actionNameEnc].value);

But doesn't see those values geting reflected in the HTML DOM or the
runtime html code in the debugger.
Even after I submit the form using form.submit() in my javascript
function, the above alert() can print out the correct value but it is
not getting reflected in the HTML DOM/ code.

Even the code snippets that you have pasted does the same.
I have only one form in my html.

As I've described the problem in my first post, my scenario is with two
radio buttons and a tree(not selectable) on the page. With one radio
button, i see the HTML DOM(/ or the dynamic html code) getting updated
correctly as i walking through the debugger which was getting finally
sent(and seen) to the serverside correctly.
But with the other radio button the problem starts showing up, where
the wrong DOM is sent to the server side.

I know that the window, the document and the forms object in my alert
statements are part of the DOM, but though the DOM itself doesn't show
up the corect values.

Thanks again for working on my problem. .
Ravi.

ravi said:
The follwoing Code in my javascript writes the values to the form
input.

actionNameEnc is the name for the form input.
actionValue is the value that takes the values of tree collpase or
expand.
so the actionValue should be assgined to the actionNameEnc and returned
to the server.


<form ......>
<input type="hidden" value="actionNameEnc" name="actionNameEnc"
id="actionNameEnc"/>

<...javascript code....>
form[actionNameEnc].value = actionValue ;
alert(form[actionNameEnc].value); // this shows the correct
runtime value but is not seen in DOM

I'm not clear on what do you mean by "seen in DOM". I hope it doesn't
mean "reflected in page source text" as it is not possible so your
attempt are futile. From what I got (correct me if I'm wrong):

document.forms["myForm"].elements["actionNameEnc"].value = actionValue;
alert (document.forms["myForm"].elements["actionNameEnc"].value);

That's with your form like
<form name="myForm" ....
...
<input type="hidden" name="actionNameEnc">
...
 
V

VK

ravi said:
Iam having the firebug debugger as a plugin for firefox.
this tool shows the HTML DOM representation for the different html
elements of the page source. And shows the runtime values changing for
the html elements as i walk through the debugger.

Firebug is a kappa-stage version of a 3rd party extension for Firefox.
So if it does show what is really happening then so is better; if it
says that Firefox is contacting the White House to start the 3rd World
War then just freely skip on this message. :)

If my previously posted code didn't help you then forget of Firebug for
just a second and post the entire page you are working on (or an URL)
with exact comments on what property has to have what value.
 

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
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top