Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    InterDev template <P><%#Enter project name#%></P>

    I'm learning to use InterDev from a book (Sams Teach Yourself Visual InterDev 6 in 24 Hours) and have created a template that contains the following:



    [Project Name] Technical Documentation</P>

    Now I've changed that to prompt the user for the Project Name (all HTML shown):

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE></TITLE>
    </HEAD>
    <BODY>



    <%#Enter the project name#%> Technical Documentation</P>

    </BODY>
    </HTML>

    This does create a new copy when selected from the ADD box, but it doesn't prompt for the 'Project Name'. Can anyone point out what I'm doing wrong? I'm trying to get everything to work before proceeding.

    Thanks!

    Randy

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InterDev template <P><%#Enter project name#%></P>

    I think you're confusing this with a parameter query in Access. ASP runs on the Server-side. It sounds like you're asking for an Input box on the client side. You would need to use either a Form field or Javascript for this.

    Are you planning to store the value in a database of some sort or just display it on the page?

    If you just want to display the value you can use code like this:<pre><%@ Language = VBScript %>
    <html>
    <body>
    <form action="<%=Request.ServerVariables("SCRIPT_NAME")% >" method="post">
    <% If Request.Form("ProjectName") = "" Then %>
    Enter the Project Name: <input type="text" name="ProjectName">

    <input type="submit" value="Submit">
    <% Else %>
    <%=Request.Form("ProjectName")%> Technical Documentation

    <input type="submit" value="Clear Value">
    <% End If%>
    </form>
    </body>
    </html></pre>


  3. #3
    Star Lounger
    Join Date
    Feb 2002
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InterDev template <P><%#Enter project name#%></P>

    Thanks for the help. This is supposed to just prompt the user for the Project Name so they don't forget to input it, and then use it for the new page. It's not to be stored anywhere else. I pasted your code into a new page, but I if I try to go into Design view I get "The editor is unable to switch to Design view because there is unquoted ASP script in a attribute value or inside a <select> tag.

    When I switch to Quick View it looks like <font color=blue>" method="post">Enter the Project Name [an input box] [a submit button] Technical Documentation [a clear value button]</font color=blue>. If I press one of the buttons it goes to the "The Page Cannot Be Found" screen.

    I appreciate your help -- I think that the best way to figure this out is to keep stumbling around in it. I am having fun doing it.

    Thanks,

    Randy

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: InterDev template <P><%#Enter project name#%></P>

    I see what you mean. One thing you should understand is that ASP is based on code (usually VBScript). Although there is an aspect of web design (i.e. page layout with HTML), you have to understand the concepts of scripting before you can do much with ASP.

    If you'll look at my example, you'll see that it is based on an IF statement. I'll translate:

    I used a Request.ServerVariables for the Form's action (because I didn't know your file's name and this will grab the name of the file for you).
    If the Form variable "ProjectName" is not empty, then write: Enter Project Name (textbox), (submit button).
    Otherwise (the Form variable "ProjectName" is NOT empty - this assumes the form has been submitted to itself) then write: the ProjectName variable and "Technical Documentation", (another submit button that will submit the form again, this time with an empty ProjectName variable, which will trigger the first part of the IF statement).

    Does that make more sense? You will NOT be able to view most ASP files in "Design" view because they don't work that way. The Design view will not know what to do with the blocks of script. Most ASP pages are generated from script that is interpreted by the server at run time. That's just the nature of ASP.

    Hope this helps!

    PS - just to clarify how to use my previous example: Copy the entire block of code and save it as its own file. Call it anything you like, but end it with .ASP. Then view the file in a web browser through your server, such as: http://Server/test/ScriptTest.asp

Posting Permissions

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