Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question document.formname.fieldname.value not returning value

    Hello Everyone,
    I have a page(Page A) which has user profile details like username, password etc , all Labels. Each label has a link called "Edit". When user clicks on Edit, the label changes to a textbox so that the user can modify his details. For this iam using AJAX. To change the label to a textbox, im using another page(Page B) which takes the request from Page A using AJAX, and sends the textbox's <input> tag in the response to Page A. After this im placing the response in PageA using innerHTML. Thats fine. Now i need to perform validations when the user submits the page. For this im tryin to use document.formname.fieldname.value in the javascript to get that value after editing, so that i can check that value for validations. Now the problem is, after Edit is clicked the document.formname.fieldname.value returns undefined, eventhough value is present in the textbox. I need to know the reason for that. I have tried using getElementById(), and i was successful in retrieving the value. But thats not the concern. I need to use document.formname.fieldname.value to get that value. Plz help. Thanks in advance.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    how could we know why? Show us the code.
    I need to use document.formname.fieldname.value to get that value.
    Really? How's that? What is the importance of how you get a value? If the code works, it's ok.
    Last edited by Kor; 08-04-2006 at 08:50 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New Coder
    Join Date
    Jul 2006
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    like KOR said if getElementById() works then use that.

  • #4
    Regular Coder
    Join Date
    Sep 2005
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The only thing I can think of (being that we can't see the code, so I may be missing the problem) is that when you put the item back onto the page, you are not attaching it to the form. You may need to appendChild or replaceChild to have the DOM register that the element is attached to the form.

    Otherwise I'd go with what the others suggested; if getElementById works, just use that instead.
    If you want answers, write a smart question.

    Yes, someone probably does know how...

    Oh, and if you want to learn, STFW!

  • #5
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    The code ... the code... We need the code ( or the link to the test page on server, or an attachment)
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •