Results 1 to 8 of 8

Thread: How should Run At Server scripts be added to a web page

  1. #1
    Phil Kingsland
    Guest

    Default How should Run At Server scripts be added to a web page

    I have been trying to code a server side VBscript to generate custom
    HTML with the Response.Write statement.

    It seems the generated code is always appended to the web page rather
    than inserted at the point I place the script.

    I must be missing some setting or parameter but have no clue what it may be.

    Any suggestions or a simple example will be welcome.

    TIA: PhilK

  2. #2
    Senior Member
    Join Date
    Apr 2010
    Posts
    352

    Default

    It will depend on the script you're talking about specifically, however, how are you adding the script? You generally just place a text box where you want the script to place the HTML your script generates and then press CTRL+T and paste in your script.

  3. #3
    Phil Kingsland
    Guest

    Default Re: How should Run At Server scripts be added to a web page

    I typed the script directly into the objects HTML popup window.

    Here is a simplified extract of the code

    /*<select id="FormsComboBox3" name="FormsComboBox3" style="height: 24px;" */
    <script language="VBscript" runat="server">
    Set fso = CreateObject("Scripting.fileSystemObject")
    myFile = fso.GetFolder(server.mappath("/")) &
    "/cmcworksorder/district.csv"
    ....
    ....
    Response.Write "<option value=" & sDistrict & ">" &
    sDistrict & "</option>"
    ....
    ....
    Set fso = Nothing
    </script>

    >

    /* <option value="dummy">You must select an address</option>
    </select>*/

    !!!! I think I have just spotted the (or another) problem while copying
    the above clips. The grayed NOF code has the closing > for the <select
    id...... phrase so I have been inserting my script in the wrong place.
    I guess I must put a close > at the top of my inserted code and put a
    dummy parameter at the end of my code to use the NOF's closing >

    ???


  4. #4
    Phil Kingsland
    Guest

    Default Re: How should Run At Server scripts be added to a web page

    After more research & many uploads I have found this works. *BUT is it
    the correct/best practice ?*

    /*<select id="FormsComboBox3" name="FormsComboBox3" style="height: 24px;" */
    >

    <%
    Set fso = CreateObject("Scripting.fileSystemObject")
    myFile = fso.GetFolder(server.mappath("/")) &
    "/cmcworksorder/district.csv"
    ....
    Response.Write "<option value=>Please select your
    Address.</option>"
    ....
    Set fso = Nothing
    %>
    <br
    /*>
    <option value=>You must select an address</option>
    </select>
    */
    The items in red are just there to get the code in the legal position.


  5. #5
    Senior Member gotFusion's Avatar
    Join Date
    Jan 2010
    Location
    www.gotHosting.biz
    Posts
    4,529

    Default

    You can control the placement of scripts by using the HTML insertion option.

    Inside a table cell or text box press CTRL+T this will bring up the html insertion dialog box. Paste your script in there. If there is not an existing table or text box where you wish the script to show, create one to hold the script.
    NetObjects Fusion Cloud Linux enabled Web Hosting, support + training starts at $14.95
    NetObjects Fusion web Hosting and support + ASP + PHP + ColdFusion + MySQL + MS SQL
    FREE NetObjects Fusion Support & training comes with all web hosting accounts
    NetObjects Fusion Web Hosting: http://www.gotHosting.biz

  6. #6
    Phil Kingsland
    Guest

    Default Re: How should Run At Server scripts be added to a web page

    I find in my 'NOF 11' that CTRL-T does not work for form fields so I
    used the HTML button in the controls property box.

    It seems the <script language="VBscript" runat="server"> statement was
    my main error and should have been using <%



  7. #7
    Senior Member gotFusion's Avatar
    Join Date
    Jan 2010
    Location
    www.gotHosting.biz
    Posts
    4,529

    Default

    Quote Originally Posted by Phil Kingsland View Post
    I find in my 'NOF 11' that CTRL-T does not work for form fields so I
    used the HTML button in the controls property box.

    It seems the <script language="VBscript" runat="server"> statement was
    my main error and should have been using <%

    Sorry missed your combo box code example.

    Are you trying to populate a combo box using vbscript? http://support.microsoft.com/kb/180911

    You may be better off not using the Fusion combo-box tool and coding the entire combo-box. Use the CTRL+t method to manually code a combo-box with vbscripting in the table cell that you had the Fusion combo-box tool in. It will not show in page view but once the page is generated and uploaded to your server the vbscript combo-box will show just fine
    NetObjects Fusion Cloud Linux enabled Web Hosting, support + training starts at $14.95
    NetObjects Fusion web Hosting and support + ASP + PHP + ColdFusion + MySQL + MS SQL
    FREE NetObjects Fusion Support & training comes with all web hosting accounts
    NetObjects Fusion Web Hosting: http://www.gotHosting.biz

  8. #8
    Phil Kingsland
    Guest

    Default Re: How should Run At Server scripts be added to a web page

    Yes dynamic update of options is what I am wanting.
    I have managed it by coding a loop of <option statements.

    I wanted to use the AddItem technique like I would in normal VB
    application development but once I cracked the <% syntax and figured
    NOF's quirk of putting the terminating > in its final gray code section
    all is now well.

    If I get a bit of time spare I will try recoding to use the AddItem
    technique as its much better.

    Thanks for the KB ref, its exactly what I was initially trying to do.

    Phil

Posting Permissions

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