Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Unable to read value of Text Field : Any help?

New Here ,
Mar 14, 2007 Mar 14, 2007
I've following DOM structure:
body
form
div1
div2
textfield
button
div3
button

etc.


For some reason, I am unable to read the value of the textfield. What I am doing is...on div2 I've a button, onclick this div2 is hidden & div3 comes on the front. But, on trying to read this value of textfield...(where user is supposed to enter value), I am trying this:
----------------------------------------------------------------------------------------------------------------
var divElements=document.getElementsByTagName('div');
alert(divElements[1].getElementsByTagName("input")[1].value);
----------------------------------------------------------------------------------------------------------------
Alert returns ampty alert. :(

What am I doing wrong?

Regards
Webcoder
TOPICS
Extensions
441
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 15, 2007 Mar 15, 2007
Try something similar to:

var myDivs = dw.getDocumentDOM().getElementsByTagName("div");
paramObj.div__tag = myDivs[0];

alert(myDivs[0]);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2007 Mar 21, 2007
LATEST
Hi envision3d,

Thanks for your response. I am now able to capture the values. :)
Now...interestingly I have landed in to a different problem.

Basically, I need to put a javascript on the head part of the document. So, what I have done is:

var theHeadNode=curDOM.getElementsByTagName('head');
var rtnScript="<script content...>";
theHeadNode[0].innerHTML+=rtnScript;

Interestingly...if I keep my cursor outside the DOM (you will get clarity by looking at the attached screenshot), it throws an error. How do I prevent this? The line number showed in the error has following code:

theHeadNode[0].innerHTML+=rtnScript;

Can you please advise on this?

Thanks in advance.
Regards
Webcoder

PS: I have uploaded a snapshot at: http://www.innindia.com/extensions/images/dw_error.JPG
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines