SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with IF statements and quotes

    I'm having problems getting some ASP code to work with a form I'm using. I'm using the script with a multiple page form and want to print a javascript onsubmit value for just one of the forms. I'm getting errors because of the multiple IF statements and I'm not sure how to do this and have the "s show up properly in the output. Can someone tell me how to do this properly?

    Code:
    <% If step < 5 Then Response.Write "    <form action="/script.asp" method="post" name="theForm" id="theForm" & If step < 1 Then Response.Write " onsubmit=""" & "return checkForm(this);" & End If %> & ">" & End If %>
    Here is how I want it to output:

    <form action="/script.asp" method="post" name="theForm" id="theForm" onsubmit="return checkForm(this);">

    (I only want the onsubmit to print if step is less than 1)
    John Saunders

  2. #2
    SitePoint Enthusiast Nawaz Ijaz's Avatar
    Join Date
    Feb 2005
    Location
    Lahore, Pakistan
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is the way to display quotation marks, As my name is printed.
    I did your art too. As it is the form tag you have to go to the html source to see the html generated code.


    <%
    Response.Write """" & "nawaz" & """"
    response.write "<br>"

    step=0
    If step < 5 Then
    Response.Write "<form action=" & """" & "/script.asp" & """" & " method=" & """" & "post" & """" & " name=" & """" & "theForm" & """" & " id=" & """" & "theForm" & """"
    If step < 1 Then
    Response.Write " onsubmit=" & """" & "return checkForm(this);" & """" & ">"
    end if
    End If
    %>

    Here is the out put aa the html source
    <form action="/script.asp" method="post" name="theForm" id="theForm" onsubmit="return checkForm(this);">
    Nawaz Ijaz [Lahore, Pakistan]
    Boy: He is big..i wont like to fight him...
    Achilles: Thatz Y no one wud remember u after thousand years...!!

  3. #3
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot!
    John Saunders


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
  •