Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: Correct syntax?

  1. #1
    Regular Coder
    Join Date
    Feb 2014
    Posts
    265
    Thanks
    47
    Thanked 0 Times in 0 Posts

    Correct syntax?

    Hello

    I am getting a couple of 'incorrect syntax' server errors when trying to insert a couple of <h4> tags in the following:

    Code:
    SaveFiles = SaveFiles & "Checkbox values = " & Upload.Form("checkbox_values") & "<br>"
    	SaveFiles = SaveFiles & "List values = " & Upload.Form("list_values") & "<br>"
    	SaveFiles = SaveFiles & "Text area = " & Upload.Form("t_area") & "<br>"
    I did have them like this:

    Code:
    SaveFiles = SaveFiles & "Checkbox values = "<h4> & Upload.Form("checkbox_values") & </h4>"<br>"
    	SaveFiles = SaveFiles & "List values = "<h4> & Upload.Form("list_values") & </A4>"<br>"
    	SaveFiles = SaveFiles & "Text area = "<h4> & Upload.Form("t_area") & </A4>"<br>"
    What should the syntax be, please?

    Blue

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,100
    Thanks
    2
    Thanked 23 Times in 23 Posts
    You had some quotation marks in the wrong place, plus "A4" instead of "H4" in a couple of places. Try this instead:
    SaveFiles = SaveFiles & "Checkbox values = <h4>" & Upload.Form("checkbox_values") & "</h4><br>"
    SaveFiles = SaveFiles & "List values = <h4>" & Upload.Form("list_values") & "</h4><br>"
    SaveFiles = SaveFiles & "Text area = <h4>" & Upload.Form("t_area") & "</h4><br>"
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • Users who have thanked vinyl-junkie for this post:

    Blue1 (04-30-2014)

  • #3
    Regular Coder
    Join Date
    Feb 2014
    Posts
    265
    Thanks
    47
    Thanked 0 Times in 0 Posts
    Hello vinyl-junkie

    Thank you for that - I am just trying your code now.

    And would this line be coded like this:

    Code:
    SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName &  <h4>" (" & Upload.UploadedFiles(fileKey).Length & "B) </h4>"
    Thanks!

  • #4
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,929
    Thanks
    46
    Thanked 203 Times in 202 Posts
    Still have a " in the wrong place
    Code:
    SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName &  "<h4> (" & Upload.UploadedFiles(fileKey).Length & "B) </h4>"
    You need " around coded strings (not strings as variables)
    eg
    Code:
    string cat = "cat"
    string dog = "dog"
    string demo = cat $ dog  'equals "catdog"
    demo = cat & " " & dog   'equals "cat dog"
    string example = cat & " text within quotes " & dog & " more text." 'equals "cat text within quotes dog more text."

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #5
    Regular Coder
    Join Date
    Feb 2014
    Posts
    265
    Thanks
    47
    Thanked 0 Times in 0 Posts
    Hello alykins

    Thanks again for your post.

    I have copied and pasted your script:
    Code:
    SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName &  "<h4> (" & Upload.UploadedFiles(fileKey).Length & "B) </h4>"
    , except that I have replaced <h4></h4> with <p></p>.

    What should be shown centred onscreen after a user has uploaded a file here Upload your file is something like: NameOfFile.txt (42B). The other items, 'Enter a number', 'checkbox values', 'list values', and 'Text area', ARE centred onscreen using the following:

    Code:
    SaveFiles = SaveFiles & "<br><p class=""head1"">Enter a number = " & Upload.Form("enter_a_number") & "</p><br>"
    	SaveFiles = SaveFiles & "<p class=""head2"">Checkbox values = " & Upload.Form("checkbox_values") & "</p><br>"
    	SaveFiles = SaveFiles & "<p class=""head3"">List values = " & Upload.Form("list_values") & "</p><br>"
    	SaveFiles = SaveFiles & "<p class=""head4"">Text area = " & Upload.Form("t_area") & "</p><br>"
    but the line you have kindly replied to, that is:
    Code:
    SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & "<p class=""head5""> (" & Upload.UploadedFiles(fileKey).Length & "B) </p>"
    splits the file so that the name of the file, which is incorrectly left-aligned, is separated from the size of the file which is centred along with the other items mentioned above. I have attached a screenshot to give you a better idea.

    That's what I am having a problem with at the moment.

    Thank you for your example. It's the kind of thing I need to digest. I know I had trouble with my own code snippet above with TWO lots of inverted commas around the CSS class name!

    Correct syntax?-codingforums.jpg

    Thanks again for your time.

    Blue

  • #6
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,929
    Thanks
    46
    Thanked 203 Times in 202 Posts
    do you have a link to your page? It sounds like at this point you are having an HTML/CSS formatting issue as opposed to an ASP issue. However, this line is going to cause problems
    Code:
    SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & "<p class=""head5""> (" & Upload.UploadedFiles(fileKey).Length & "B) </p>"
    let's pretend that SaveFiles is string.Empty at this point, and the file name is "cat.txt" and some int for the length as well
    Code:
            Dim SaveFiles As String = String.Empty
            Dim cat As String = "cat.txt"
            Dim i As Integer = 3
            SaveFiles = cat & "<p class=""head5""> (" & i & "B) </p>"
    you will get this output
    Code:
    "cat.txt<p class="head5"> (3B) </p>"
    See? That cat.txt is just hanging out without a containing HTML element. And it's behaving "badly" like an HTML element out of place (ie not a code error per se from what has been shown)

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #7
    Regular Coder
    Join Date
    Feb 2014
    Posts
    265
    Thanks
    47
    Thanked 0 Times in 0 Posts
    Yes, the link is this: Upload your file

    I have managed to half-resolve the problem with this:
    Code:
    SaveFiles = SaveFiles & "<p class=""head1"">" & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & " B)</p>"
    That class file 'head1' looks like this:

    Code:
    p.head1
    {
    text-align:center;
    color:#ffffff;
    font-family:'Droid Sans',arial,sans-serif;
    font-size:90%;
    }
    which makes things a bit tidier.

    If you were to upload any old file you would see something like the file I am attaching, but do you see that big space (where I have the yellow star)?

    Correct syntax?-files_uploaded.jpg

    In my ASP I have:

    Code:
    SaveFiles = SaveFiles & "<p class=""head1"">" & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & " B)</p>"
    
            next
        else
            SaveFiles = "No file selected for upload or the file name specified in the upload form does not correspond to a valid file in the system."
        end if
    	SaveFiles = SaveFiles & "<br><p class=""head2"">Enter a number = " & Upload.Form("enter_a_number") & "</p>"
    	SaveFiles = SaveFiles & "<p class=""head3"">Checkbox values = " & Upload.Form("checkbox_values") & "</p>"
    	SaveFiles = SaveFiles & "<p class=""head4"">List values = " & Upload.Form("list_values") & "</p>"
    	SaveFiles = SaveFiles & "<p class=""head5"">Text area = " & Upload.Form("t_area") & "</p>"

    Do you think the space I have highlighted with the yellow star is to leave room for that line in red?

    Strictly speaking I don't need 'checkbox values', or 'List values', it was just to show the user the name and size of the file uploaded and to confirm that it had in fact actually been uploaded.

    Thanks again.

  • #8
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,929
    Thanks
    46
    Thanked 203 Times in 202 Posts
    I honestly have no clue if that's enough room or not. You can test it by just having it write that in there by default instead of a condition. More importantly, the original issue seems* to be resolved. I would make a new thread in the HTML/CSS section of the forum and ask your formatting questions there (don't ask any ASP questions or post ASP code or you will get bashed). The link is VERY helpful- I don't know what browser you use, but Chrome has right-click inspect element, IE has developer tools (press F12), and Firefox has firebug (have to download it I think); anyways, I haven't touched HTML/CSS in like 2 years, I do server-side coding. My HTML/CSS is rusty :P

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

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