handling form input names with quotes in them

Discussion in 'Programming' started by forumposters, Mar 30, 2007.

  1. #1
    I'm trying to name a input of type checkbox like this:
    <input type="checkbox" name="#tagname#" value="#tagid#" />

    And, I'm running into problems when the name has a quote in it.
    For example, if #tagname# is 24" X 24" it turns into just 24 as the url variable after the form is submitted

    Is there someway to stop this from happening or should I just not be naming the input with the tagname? How else can I send both the name and the id as urls variables?
     
    forumposters, Mar 30, 2007 IP
  2. datropics

    datropics Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Is this even possible to have field names with spaces and quotes in HTML - I don't know. This is not a ColdFusion question.

    However, what coldFusion can do is strip all the spaces and quotes off of the URL variable, consider:

    ReplaceNoCase

    HTH
     
    datropics, Mar 30, 2007 IP
  3. forumposters

    forumposters Peon

    Messages:
    270
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I've discovered that HTMLEditFormat is a built-in Coldfusion function that I can use for this. However, I'm not sure of an easy way to reverse the changes that this function makes to the form variable. Anyone have an answer for that?
     
    forumposters, Jun 18, 2007 IP
  4. drewbe121212

    drewbe121212 Well-Known Member

    Messages:
    733
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    125
    #4
    Why would you want to reverse it?

    You use HTMLEditFormat whenever you want to display data. Meaning, if you are going to save it in the database save it in the database as 24" X 24", though when you go to display it again use HTMLEditFormat
     
    drewbe121212, Jun 18, 2007 IP
  5. Paul_Hopkinson

    Paul_Hopkinson Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    just change the spaces for a delimter such as an underscore - that way you can change it back
     
    Paul_Hopkinson, Jun 18, 2007 IP