SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast lucky20's Avatar
    Join Date
    Oct 2010
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to hide the id field and values from URL

    hi
    I have a classic asp form..which will get the data from database.
    Onec the user clik on the id (link) it simply redirects to another page with field values.

    this is how the path now.
    http:/localhost/folder/sample1.asp?id=23

    Now i want to hide the id field and value in url. Then it should be
    http:/localhost/folder/sample1.asp

    here id and values are hidden

    and form method is "post".
    I used Request.form(id) instead of request.querystring(id)

    so don't know anything about it..
    can any one know how to hide the field from url

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,609
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    There's no ASP way of making this work. It really requires JavaScript to work seamlessly. One way would be to have a form with a hidden field, where the form action="sample1.asp" and method="POST". When the link is clicked call a JavaScript function to put the link value into the the hidden field, then submit the form. If JavaScript is disabled then the querystring version will still work.

    In the ASP page use Request.Form first, then if this is empty use Request.Querystring. If even that is empty then make sure nothing else happens.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Enthusiast lucky20's Avatar
    Join Date
    Oct 2010
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @site guru

    good suggestion..
    i used it javascript to hide the value but it is not displaying any values in the ssecond form..in url the values are hidden..

    form1 has

    Code ASP:
    <td> <a href="#" onClick="document.getElementById('hdnID').value  = '<%=Id%>'; document.form1.submit();"><img src="edit.jpg" alt="Edit" width="29" height="19" border="0" align="absmiddle" /></a></td>

    form2 has

    Code ASP:
    <%
     OpenSQLConn 
    SQL = "Select * from ltbl_masterinventt where Itemid = " & Request("hdnID")
    response.write "Itemid-" & request("hdnID")
    'Response.write SQL
    Response.End
    Set rs=Conn.Execute(SQL)
    %>
          <form method="post" action="form2.asp" name="form1">
          <input type="hidden"name="hdnID" value="<%= Request.Querystring("Id")%>">

    can you give some idea..

  4. #4
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In Form1 first check if your javascript onClick event saving value in 'hdnID'.

    Than in Form2 check if 'hdnId' was passed to it by 'Response.write(Request ("hdnId"))'.

  5. #5
    SitePoint Enthusiast lucky20's Avatar
    Join Date
    Oct 2010
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @ithighway

    when use onclick..it is displaying id value..
    but in form2 it is not displaying any id value..

  6. #6
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't the hidden input type be set with the value without javascript?

    <input type="hidden" value="<%=id %>" />


Bookmarks

Posting Permissions

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