Is hidden field required..?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sureshl
    New Member
    • Jan 2009
    • 23

    Is hidden field required..?

    Am facing a problem, with this script...
    I want two fields to be written by star , in order to hide . and this script does it , but ,
    wat actually is my page opens directly with star letter , rather i need to open my page with the phoneno and email aftr clicking the button i want to make a change to the star to the respective fields ..........
    How can i do this...plz suggest??

    Code:
    vbscript
    function getPhone(text)
    dim textsize 
    textsize = Len(text)
    text = Left(text,5)
    For index = 0 to textsize
    text = text & "*"
    Next
    getphone = text
    End Function
     
    Function getEmail(text)
    dim textsize
    textsize =Len(text)
    dim atpos
    atpos = instr(text,"@") - 5
    text = Left(text,5)
    For index = 0 to textsize
    if atpos = index+1 then
    text = text & "@"
    else
    text = text & "*"
    end if
    Next
    getemail = text
    End Function
    
    Set oConn = Server.CreateObject("ADODB.Connection")
          Set oRs = Server.CreateObject("ADODB.Recordset")
          oConn.Open "Provider=SQLOLEDB; Data Source = ria; Initial Catalog = northwind; Integrated Security = sspi;"  
    
     sSql =  "SELECT  phone,email,id FROM tbl1  userid =4 "
      oRs.Open sSql, oConn 
         While not oRs.EOF 
    Response.write("<table><tr><form method='post'><td >phone : </td><td>"&getPhone(ors(0))&"</td><td width='10%'align='right'mail :</td><td>"&getEmail(ors(1))&"</td><input name='submit' type='submit' value='check'><input type='hidden' name='nameid' value='" & ors(2) & "' ></form></tr></table>")
    	   oRs.MoveNext()
        Wend  
    	ors.close
    	oconn.close  
    	
    if request.form("submit")="check" then
    
    i=1
    end if
    if  request.form("nameid") <> "" then
    set star1 = oConn.Execute("select resid from tbl1 where id= '" &request.form("nameid")&"'")
    if not star1.eof then
    sl = "UPDATE tbl1 SET star = '" & i & "' where resid= '" &request.form("nameid")&"' and userID = " & userid 
    oConn.Execute sl
    End if
    End if 
    	
    	%>
  • Nicodemas
    Recognized Expert New Member
    • Nov 2007
    • 164

    #2
    So that I may fully understand the answer you seek, are you saying you want your code to output the phone number and e-mail address in plain text, and then when a user clicks on one or the other it will obfuscate part of the relevant string?

    OR, are you asking for the reverse scenario where the relevant strings are obfuscated and need to be clicked on to remove the stars?

    Comment

    • sureshl
      New Member
      • Jan 2009
      • 23

      #3
      want my code to output the phone number and e-mail address in plain text, and then when a user clicks on one or the other it will obfuscate part of the relevant string......

      Page should open like ..
      21323
      dsad@dsa.com
      check (button) aftr clicking

      then
      213***
      ds**@*****

      Comment

      • Nicodemas
        Recognized Expert New Member
        • Nov 2007
        • 164

        #4
        I would suggest a JavaScript solution instead of an ASP solution. I suggest this because the answer you seek is only for an update to the Document Object Model.

        An ASP solution for what you are asking would require a full HTTP Request/Response cycle to complete the process. The ASP is much slower than using JavaScript would be; and, the ASP solution would cause more server overhead.

        Go to the JavaScript forum and ask the experts there the following question, and provide them with the following sample code:

        JavaScript Experts,

        I have the following HTML. How could I use JavaScript such that when a user clicks on the checkbox in each row the phone numbers and e-mail addresses are partially obfuscated with asterisks?

        Code:
        <table><tr><form method='post'><td>phone:</td><td>21323</td><td width='10%' align='right'>mail:</td><td>bob@example.com</td><input name='submit' type='submit' value='check'><input type='hidden' name='nameid' value='6' ></form></tr></table>
        By the way, I found an error in your code. Modify line 35 of your code below to this. You didn't close a TD tag properly.
        Code:
        Response.write("<table><tr><form method='post'><td>phone : </td><td>"& getPhone(ors(0))&"</td><td width='10%' align='right'>mail:</td><td>"&getEmail(ors(1))&"</td><input name='submit' type='submit' value='check'><input type='hidden' name='nameid' value='" & ors(2) & "' ></form></tr></table>")

        Comment

        Working...