Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error: The parameter 'addresses' cannot be an empty string.

Error: The parameter 'addresses' cannot be an empty string.

Scheduled Pinned Locked Moved ASP.NET
csharpsysadmindata-structuresdebugginghelp
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 8761667
    wrote on last edited by
    #1

    Hello The above is the error message I am getting followed by a long Stack Trace. I have a small form here http://www.dimadayoub.net/contact.aspx[^] and, to test it, I leave the email field blank on purpose (when I do the same for the other two fields, Name and Message, I get an on screen warning to complete the fields - which is what should happen). When I do the same with the email field, I get the above server error. The relevant code I have is this:

    What should I be correcting, please?

    Richard DeemingR 1 Reply Last reply
    0
    • M Member 8761667

      Hello The above is the error message I am getting followed by a long Stack Trace. I have a small form here http://www.dimadayoub.net/contact.aspx[^] and, to test it, I leave the email field blank on purpose (when I do the same for the other two fields, Name and Message, I get an on screen warning to complete the fields - which is what should happen). When I do the same with the email field, I get the above server error. The relevant code I have is this:

      What should I be correcting, please?

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Remove the ValidationGroup="vgSubmit" attribute from both validators. Neither of your other validators have a validation group set, and neither does your submit button. Specifying Validation Groups | MSDN[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      M 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Remove the ValidationGroup="vgSubmit" attribute from both validators. Neither of your other validators have a validation group set, and neither does your submit button. Specifying Validation Groups | MSDN[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        M Offline
        M Offline
        Member 8761667
        wrote on last edited by
        #3

        Many thanks, Richard, for your reply. I have done as you suggested and made a couple of other alterations. The code now looks like this:

        The result is that when I complete the 3 fields correctly, the form is sent. When I complete the Name and Message fields, and Email field (without the @), I get an on screen error: 'Please complete the Email field' (for some reason it is in a white font and not the red of ="#FF6666"). I will amend that so it reads 'Please enter a valid email address'. When I leave the email field blank entirely (the form does not get sent, which is fine), but I can see a little asterisk. I presume that asterisk is this:

        ErrorMessage="*"

        Can I not replace that asterisk with the on screen message: 'Please complete the Email field'? Thanks again.

        Richard DeemingR 1 Reply Last reply
        0
        • M Member 8761667

          Many thanks, Richard, for your reply. I have done as you suggested and made a couple of other alterations. The code now looks like this:

          The result is that when I complete the 3 fields correctly, the form is sent. When I complete the Name and Message fields, and Email field (without the @), I get an on screen error: 'Please complete the Email field' (for some reason it is in a white font and not the red of ="#FF6666"). I will amend that so it reads 'Please enter a valid email address'. When I leave the email field blank entirely (the form does not get sent, which is fine), but I can see a little asterisk. I presume that asterisk is this:

          ErrorMessage="*"

          Can I not replace that asterisk with the on screen message: 'Please complete the Email field'? Thanks again.

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          The ErrorMessage is the message that gets displayed in the ValidationSummary. The Text is the message that gets displayed in-line. If you set the ErrorMessage without setting the Text, the same message is used in both places. You've used Display="None", so the validators aren't showing up in-line. Instead, the ValidationSummary is showing all of the error messages next to the email field. You haven't applied any styles to the ValidationSummary, which is why the messages are white. I'd be inclined to put a single ValidationSummary at the top of your form. Then, for each validator, set the ErrorMessage to the message you want to display, the Text to *, and the Display to Dynamic.


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          M 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            The ErrorMessage is the message that gets displayed in the ValidationSummary. The Text is the message that gets displayed in-line. If you set the ErrorMessage without setting the Text, the same message is used in both places. You've used Display="None", so the validators aren't showing up in-line. Instead, the ValidationSummary is showing all of the error messages next to the email field. You haven't applied any styles to the ValidationSummary, which is why the messages are white. I'd be inclined to put a single ValidationSummary at the top of your form. Then, for each validator, set the ErrorMessage to the message you want to display, the Text to *, and the Display to Dynamic.


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            M Offline
            M Offline
            Member 8761667
            wrote on last edited by
            #5

            Thanks again. I think I am beginning to see what you mean - it will take some time for me to digest all your kind points. Yes, I can make those changes and see the results. Do you mean apply CSS to ValidationSummary1, and not RegularExpressionValidator2, in order to add style to 'Please complete the Email field'?

            Richard DeemingR 1 Reply Last reply
            0
            • M Member 8761667

              Thanks again. I think I am beginning to see what you mean - it will take some time for me to digest all your kind points. Yes, I can make those changes and see the results. Do you mean apply CSS to ValidationSummary1, and not RegularExpressionValidator2, in order to add style to 'Please complete the Email field'?

              Richard DeemingR Offline
              Richard DeemingR Offline
              Richard Deeming
              wrote on last edited by
              #6

              You need to add style to both - the style on the ValidationSummary will apply to the summary messages at the top of the form, and the style on the individual validators will apply to the "*" that appears next to an invalid field. I generally use a theme[^] folder with a .skin file to apply the same CssClass to all validators, and a CssClass to the ValidationSummary. That way, the settings are consistent across the site, and the style settings remain in the CSS file where they belong. If you don't want to add a theme to your site, you'll need to set the CssClass on each validator and ValidationSummary wherever you use them.


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

              M 1 Reply Last reply
              0
              • Richard DeemingR Richard Deeming

                You need to add style to both - the style on the ValidationSummary will apply to the summary messages at the top of the form, and the style on the individual validators will apply to the "*" that appears next to an invalid field. I generally use a theme[^] folder with a .skin file to apply the same CssClass to all validators, and a CssClass to the ValidationSummary. That way, the settings are consistent across the site, and the style settings remain in the CSS file where they belong. If you don't want to add a theme to your site, you'll need to set the CssClass on each validator and ValidationSummary wherever you use them.


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                M Offline
                M Offline
                Member 8761667
                wrote on last edited by
                #7

                Yes, there is a theme to the site: www.dimadayoub.net[^], so the style would need to be consistent. Because space there is limited - the form is small - I was thinking of displaying the error messages in the form fields themselves. My CSS is not that good to do that - not sure it can be done in HTML/CSS alone. Grateful for your time.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups