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. Other Discussions
  3. Clever Code
  4. Strange comma in Request.Form

Strange comma in Request.Form

Scheduled Pinned Locked Moved Clever Code
javascriptdockerhelpquestion
3 Posts 2 Posters 2 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.
  • K Offline
    K Offline
    Kasic Slobodan
    wrote on last edited by
    #1

    I have JS function that displays the div container with appropriate userControl for manipulating users permitions. JS funtion:

    function ConvertProfessional(id)
    {
    document.getElementById("userId").value = id;
    document.getElementById("adminPermition").style.display = '';
    document.getElementById("adminEdit").style.display = 'none';
    }

    It's a table with a bunch of the check boxes and a hidden field where would be stored user id for that particular user. When I click on a link, JS function gets called and displays the div and sets the user id in the hidden field. Hidden field:

    <input id="userId" type="hidden" name="userId" />

    Then I click on a submit button and with Request.Form["userId"] get that user id. The problem i on the picture. http://img132.imageshack.us/img132/9104/reqds0.jpg[^] Somehow, out of nowhere, comma appears :omg::wtf: I put alert(id) in the JS function and it displays proper value. I also checked with firebug when the page is rendered, and still proper value. This is how I get the value of hidden field and any other control as well. Nothing gremlin in here :).

    string uid = Request.Form["userId"];

    I don't know what is going on, but since everything is going on, I workaround a problem with this:

    uid = uid.Remove(uid.IndexOf(','));

    Pretty comfortable :-D.

    C 1 Reply Last reply
    0
    • K Kasic Slobodan

      I have JS function that displays the div container with appropriate userControl for manipulating users permitions. JS funtion:

      function ConvertProfessional(id)
      {
      document.getElementById("userId").value = id;
      document.getElementById("adminPermition").style.display = '';
      document.getElementById("adminEdit").style.display = 'none';
      }

      It's a table with a bunch of the check boxes and a hidden field where would be stored user id for that particular user. When I click on a link, JS function gets called and displays the div and sets the user id in the hidden field. Hidden field:

      <input id="userId" type="hidden" name="userId" />

      Then I click on a submit button and with Request.Form["userId"] get that user id. The problem i on the picture. http://img132.imageshack.us/img132/9104/reqds0.jpg[^] Somehow, out of nowhere, comma appears :omg::wtf: I put alert(id) in the JS function and it displays proper value. I also checked with firebug when the page is rendered, and still proper value. This is how I get the value of hidden field and any other control as well. Nothing gremlin in here :).

      string uid = Request.Form["userId"];

      I don't know what is going on, but since everything is going on, I workaround a problem with this:

      uid = uid.Remove(uid.IndexOf(','));

      Pretty comfortable :-D.

      C Offline
      C Offline
      Chris Maunder
      wrote on last edited by
      #2

      It means you have two controls in the form with the same name of "userId". One is being populated with a value, the other isn't

      cheers, Chris Maunder

      CodeProject.com : C++ MVP

      K 1 Reply Last reply
      0
      • C Chris Maunder

        It means you have two controls in the form with the same name of "userId". One is being populated with a value, the other isn't

        cheers, Chris Maunder

        CodeProject.com : C++ MVP

        K Offline
        K Offline
        Kasic Slobodan
        wrote on last edited by
        #3

        I didn't knew that and yes, your right. There are two controls with same name, I just checked. Thank you for solving the mystery ;).

        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