onclick and assigning variables?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MrGarcia
    New Member
    • Sep 2006
    • 1

    onclick and assigning variables?

    I'm trying to create a link which passes variable data to form objects (text), and also submits the form with the onClick method.

    In the head I have..

    [CODE=javascript]function submitter(one,t wo){
    document.forms[0].emailaddress.v alue = one;
    document.forms[0].officername.va lue = two;
    document.forms[0].submit();
    }
    [/CODE]
    then the link is..
    Email: [HTML]<a href="#" onClick = "submitter('non e@none.net', 'Joe Schmoe' ); ">Joe Schmoe</a><br>
    [/HTML]
    the problem is that the string 'Joe Schmoe' is not being submitted, I only get the 'Joe' part. Any clues?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Perhaps it's the server-side where the problem is.

    Comment

    • pronerd
      Recognized Expert Contributor
      • Nov 2006
      • 392

      #3
      It looks like the space is interrupting the data submission which should not happen on any modern browser. Is this submit by change being defined as a GET instead of a POST? If so inserting a space into a GET HTTP request will interrupt it.

      If nothing else works you might try encoding the data before sending it. Google can provide examples of how to do this.

      Comment

      Working...