By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,128 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

onclick and assigning variables?

P: 1
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..

Expand|Select|Wrap|Line Numbers
  1. function submitter(one,two){
  2.    document.forms[0].emailaddress.value = one;
  3.    document.forms[0].officername.value = two;
  4.    document.forms[0].submit();
  5.    }
  6.  
then the link is..
Email: [HTML]<a href="#" onClick = "submitter('none@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?
Sep 1 '06 #1
Share this Question
Share on Google+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
Perhaps it's the server-side where the problem is.
May 12 '08 #2

Expert 100+
P: 392
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.
May 15 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.