display value in textbox

Discussion in 'ASP General' started by nikou_70@yahoo.com, Dec 7, 2005.

  1. Guest

    I have a page with one text box when I search name, return value such
    as (address, phone...) I show these value in the table but I want to
    show these in text box that I have in my page.
    this is my page,
    <%@ Language=VBScript %>
    <%
    set conn=server.CreateObject ("adodb.connection")
    connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("customer.mdb") & ";Persist Security Info=False"
    conn.Open connect
    %>
    <html>
    <head>
    <script language="javascript">
    <!--
    function dept_onchange(frmSelect) {
    document.frmSelect.submit();
    }

    //-->
    </script>
    </head>
    <body>
    <form name="frmSelect" method="Post" action="search.asp">
    Name:<input type=text name=print
    onchange="dept_onchange(frmSelect);" />
    <%
    a=Request.Form ("print")
    if a<> "" then
    sqlstr2="select * from Ticket where Name='" & a & "'"
    set ors = conn.Execute(sqlstr2)

    if ors.eof=true and ors.bof=true then
    Response.Write "<br><b>No Records Matched.</b>"
    else
    numfields=ors.fields.count
    Response.Write "<table border=1 width=100% bgcolor=#c1e0ff >"
    Response.Write "<tr>"
    for i=0 to numfields-1

    Response.Write "<td><font color=CornflowerBlue face=arial
    size=2><b>" & ors(i).name & "</font></b></td>"
    next
    Response.Write "</tr>"
    ors.movefirst
    do while not ors.eof
    Response.Write "<tr>"
    for i=0 to numfields-1

    Response.Write "<td valign=top><font color=#000099 face=arial
    size=2><b>" & ors.fields(i).value & "&nbsp;</font></b></td>"
    next
    Response.Write "</tr>"
    ors.movenext
    loop
    '******************
    Response.Write "</table>"
    end if
    end if
    %>
    <table border="1">
    <tr>
    <td>
    <font size="2" face="arial" color="#339966"><strong><em>
    Name: </em></strong>
    </font></td>
    <td align="right" style="width: 184px">
    <p><input name="Name" maxlength="25">
    </td>
    <td align="right" style="width: 184px; text-align: left">
    <span style="font-size: 14pt"><p>+</p></span></td>
    </tr>
    <tr>
    <td>
    <font size="2" face="arial" color="#339966"><strong><em>
    Address:</em></strong>
    </font></td>
    <td align="right" style="width: 183px">
    <p>
    <input name="Address">

    </td>
    <td align="right" style="width: 183px">
    </td>
    </tr>
    <tr>
    <td>
    <font size="2" face="arial" color="#339966"><strong><em>
    Phone: </em></strong>
    </font></td>
    <td align="right" style="width: 183px">
    <p><INPUT TYPE="text" NAME="Phone" mask="(###)-###-####"
    onblur="return onBlurMask(this);" onfocus="return onFocusMask(this);"
    onkeydown="return doMask(this);" style="width: 155px"></td>
    <td align="right" style="width: 183px">
    </td>
    </tr>
    <tr>
    <td>
    <font size="2" face="arial" color="#339966"><strong><em>
    Status:</em></strong>
    </font></td>
    <td align="right" style="width: 183px">
    <p>

    <input name="status" style="width: 183px">

    </td>
    <td align="right" style="width: 183px">
    </td>
    </tr>
    <tr>
    <td>
    <font size="2" face="arial" color="#339966"><strong><em>
    comment:</em></strong>
    </font></td>
    <td style="width: 184px">
    <p>
    <textarea name="comment" style="width: 183px"></textarea>
    </td>
    <td style="width: 184px">
    </td>
    </tr>
    <tr>
    <td>
    </td>
    <td align="right" style="width: 184px">
    <font size="2" face="arial" color="yellow">
    <input type="Button" value="Save" id="submit1" name="submit1" >
    <input type="reset" id="reset1" name="reset1">&nbsp;</font>
    </td>
    <td align="right" style="width: 184px">
    </td>
    <td>
    &nbsp;</td>
    </table>
    </form>
    </td>
    <tr>
    </tr>
    <tr>
    </tr>
    </table>
    </form>

    </body>
    </html>
    , Dec 7, 2005
    #1
    1. Advertising

  2. Slim Guest

    If I understand correctly you simply want to present values from your server
    asp to your text box

    <input type=text name=print onchange="dept_onchange(frmSelect);"
    value="<%=someValue%>" >

    where somevalue is a variable in your asp server code

    <> wrote in message
    news:...
    >I have a page with one text box when I search name, return value such
    > as (address, phone...) I show these value in the table but I want to
    > show these in text box that I have in my page.
    > this is my page,
    > <%@ Language=VBScript %>
    > <%
    > set conn=server.CreateObject ("adodb.connection")
    > connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > Server.MapPath("customer.mdb") & ";Persist Security Info=False"
    > conn.Open connect
    > %>
    > <html>
    > <head>
    > <script language="javascript">
    > <!--
    > function dept_onchange(frmSelect) {
    > document.frmSelect.submit();
    > }
    >
    > //-->
    > </script>
    > </head>
    > <body>
    > <form name="frmSelect" method="Post" action="search.asp">
    > Name:<input type=text name=print
    > onchange="dept_onchange(frmSelect);" />
    > <%
    > a=Request.Form ("print")
    > if a<> "" then
    > sqlstr2="select * from Ticket where Name='" & a & "'"
    > set ors = conn.Execute(sqlstr2)
    >
    > if ors.eof=true and ors.bof=true then
    > Response.Write "<br><b>No Records Matched.</b>"
    > else
    > numfields=ors.fields.count
    > Response.Write "<table border=1 width=100% bgcolor=#c1e0ff >"
    > Response.Write "<tr>"
    > for i=0 to numfields-1
    >
    > Response.Write "<td><font color=CornflowerBlue face=arial
    > size=2><b>" & ors(i).name & "</font></b></td>"
    > next
    > Response.Write "</tr>"
    > ors.movefirst
    > do while not ors.eof
    > Response.Write "<tr>"
    > for i=0 to numfields-1
    >
    > Response.Write "<td valign=top><font color=#000099 face=arial
    > size=2><b>" & ors.fields(i).value & "&nbsp;</font></b></td>"
    > next
    > Response.Write "</tr>"
    > ors.movenext
    > loop
    > '******************
    > Response.Write "</table>"
    > end if
    > end if
    > %>
    > <table border="1">
    > <tr>
    > <td>
    > <font size="2" face="arial" color="#339966"><strong><em>
    > Name: </em></strong>
    > </font></td>
    > <td align="right" style="width: 184px">
    > <p><input name="Name" maxlength="25">
    > </td>
    > <td align="right" style="width: 184px; text-align: left">
    > <span style="font-size: 14pt"><p>+</p></span></td>
    > </tr>
    > <tr>
    > <td>
    > <font size="2" face="arial" color="#339966"><strong><em>
    > Address:</em></strong>
    > </font></td>
    > <td align="right" style="width: 183px">
    > <p>
    > <input name="Address">
    >
    > </td>
    > <td align="right" style="width: 183px">
    > </td>
    > </tr>
    > <tr>
    > <td>
    > <font size="2" face="arial" color="#339966"><strong><em>
    > Phone: </em></strong>
    > </font></td>
    > <td align="right" style="width: 183px">
    > <p><INPUT TYPE="text" NAME="Phone" mask="(###)-###-####"
    > onblur="return onBlurMask(this);" onfocus="return onFocusMask(this);"
    > onkeydown="return doMask(this);" style="width: 155px"></td>
    > <td align="right" style="width: 183px">
    > </td>
    > </tr>
    > <tr>
    > <td>
    > <font size="2" face="arial" color="#339966"><strong><em>
    > Status:</em></strong>
    > </font></td>
    > <td align="right" style="width: 183px">
    > <p>
    >
    > <input name="status" style="width: 183px">
    >
    > </td>
    > <td align="right" style="width: 183px">
    > </td>
    > </tr>
    > <tr>
    > <td>
    > <font size="2" face="arial" color="#339966"><strong><em>
    > comment:</em></strong>
    > </font></td>
    > <td style="width: 184px">
    > <p>
    > <textarea name="comment" style="width: 183px"></textarea>
    > </td>
    > <td style="width: 184px">
    > </td>
    > </tr>
    > <tr>
    > <td>
    > </td>
    > <td align="right" style="width: 184px">
    > <font size="2" face="arial" color="yellow">
    > <input type="Button" value="Save" id="submit1" name="submit1" >
    > <input type="reset" id="reset1" name="reset1">&nbsp;</font>
    > </td>
    > <td align="right" style="width: 184px">
    > </td>
    > <td>
    > &nbsp;</td>
    > </table>
    > </form>
    > </td>
    > <tr>
    > </tr>
    > <tr>
    > </tr>
    > </table>
    > </form>
    >
    > </body>
    > </html>
    >
    Slim, Dec 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AGSHAR
    Replies:
    1
    Views:
    591
    AGSHAR
    May 31, 2008
  2. GP
    Replies:
    0
    Views:
    265
  3. ErwinP
    Replies:
    1
    Views:
    737
    ErwinP
    Aug 19, 2005
  4. Steve
    Replies:
    4
    Views:
    208
    Steve
    Feb 7, 2006
  5. venkat reddy
    Replies:
    1
    Views:
    299
    Elegie
    Jul 8, 2011
Loading...

Share This Page