how to write the response into the textbox in ajax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • techbytes
    New Member
    • May 2010
    • 36

    how to write the response into the textbox in ajax

    I have a two textboxes.Depen ding onthe value of textbox1,textbo x2 value changes.I didit in ajax.
    I want to know after getting the response,i donot know to write or overwrite the value into the textbox.

    can give any suggestions
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    you just need to retrieve the node and set its value:

    Code:
    document.getElementById('yourId').value = 'yourValue';

    Comment

    • techbytes
      New Member
      • May 2010
      • 36

      #3
      Originally posted by gits
      you just need to retrieve the node and set its value:

      Code:
      document.getElementById('yourId').value = 'yourValue';
      I didit the above way .

      But the entire response page is written into the txtbox.
      I want only the value .

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        then you either have to parse the response and extract the value or simply just don't send an entire page as the response (which in most cases is just useless) ... just send the things that you need ...

        Comment

        • techbytes
          New Member
          • May 2010
          • 36

          #5
          Originally posted by techbytes
          I didit the above way .

          But the entire response page is written into the txtbox.
          I want only the value .
          I donot know how to get the value from the response page and assign to my textbox id.
          In my response page ,i have code like this

          Code:
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          
          <%@page contentType="text/html" pageEncoding="UTF-8"%>
          <%@ page  language="java" import="java.util.*,java.text.*"%>
          
          <html>
           <body class="popupbody" >
                 <input name="HRTIMESHEET.RANGE" type="hidden" value="<%=daterange%>" id="HRTIMESHEET.RANGE" />
          </body>
          </html>

          I have to get the daterange value and assign it to my textbox id.

          give me suggestions
          Last edited by gits; Jun 18 '10, 05:29 AM. Reason: added code tags

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            why don't you just send <%=daterange% > in your response? it is just useless overhead when you send things that are not needed ... as you see it is useless transfer and useless parsing overhead ...

            anyway - you might use a regExp to extract the value from the response

            Comment

            Working...