|
Prev: Layout of website is not flawless in Firefox and Netscappe
Next: Cheap Discount Prada Chanel LV Chloe Hermes Guess Dior Wallet, Fendi Wallet, Coach Purse, Juicy Purse, Miumiu G U C C I handbags Leather bags Discount Miumiu Leather bags MiuMiu coffee miu miu miu miu woven hobo handbags Designer Handbags
From: Kelly on 13 Jul 2008 23:15 I have a java function that returns a value in the variable "name". How can I get this value into a form field so that I can include it in the emailed form results? I don't need it as an initial value in a form field; I just need it included in the email that's sent back. I have tried making a hidden form field with the name "test" and the value "<%=name%>" but it's not getting passed.
From: jorabi1 on 13 Jul 2008 23:17 On Jul 13, 11:15 pm, Kelly <jor...(a)pobox.com> wrote: > I have a java function that returns a value in the variable "name". > How can I get this value into a form field so that I can include it in > the emailed form results? I don't need it as an initial value in a > form field; I just need it included in the email that's sent back. > > I have tried making a hidden form field with the name "test" and the > value "<%=name%>" but it's not getting passed. forgot to mention, this is a plain html form, no asp files used.
From: "Trevor Lawrence" Trevor on 14 Jul 2008 00:29 <jorabi1(a)gmail.com> wrote in message news:a7ddbc8b-7eea-438d-8cdd-8d98c7800a51(a)i76g2000hsf.googlegroups.com... On Jul 13, 11:15 pm, Kelly <jor...(a)pobox.com> wrote: > I have a java function that returns a value in the variable "name". > How can I get this value into a form field so that I can include it in > the emailed form results? I don't need it as an initial value in a > form field; I just need it included in the email that's sent back. > > I have tried making a hidden form field with the name "test" and the > value "<%=name%>" but it's not getting passed. > forgot to mention, this is a plain html form, no asp files used. Do you mean javascript ? If so, I will attempt to answer First , it is not a good idea to name a variable "name", because "name" is a keyword. So, try something else, let's say "fred". Second, I think that the construct <%=name%> IS used in ASP which you are NOT using What you need to do is to execute code in javascript which loads the variable into the form, but the variable name and value needs to be known at the time. Here is some sample code which loads the value when the " Send " button is clicked. You will probably want to do something else with the value rather than just display it, but this demonstrates that it works. <html> <head> <title>Form Test</title> <script type="text/javascript"> var fred ="abcd123"; /* global variable */ function doit() {document.form1.test.value=fred;} </script> </head> <body> <form name="form1"> <input type="text" id="test" /> <input type="button" value=" Send " onclick="doit()" /> </form> </body> </html> -- Trevor Lawrence Canberra Web Site http://trevorl.mvps.org
From: jorabi1 on 14 Jul 2008 12:47 On Jul 14, 12:29 am, "Trevor Lawrence" <Trevor L.(a)Canberra> wrote: > <jora...(a)gmail.com> wrote in message > > On Jul 13, 11:15 pm, Kelly <jor...(a)pobox.com> wrote: > > > I have a java function that returns a value in the variable "name". > > How can I get this value into a form field so that I can include it in > > the emailed form results? I don't need it as an initial value in a > > form field; I just need it included in the email that's sent back. > > > I have tried making a hidden form field with the name "test" and the > > value "<%=name%>" but it's not getting passed. > > forgot to mention, this is a plain html form, no asp files used. > > Do you mean javascript ? > > If so, I will attempt to answer > > First , it is not a good idea to name a variable "name", because "name" is a > keyword. So, try something else, let's say "fred". > > Second, I think that the construct <%=name%> IS used in ASP which you are > NOT using > > What you need to do is to execute code in javascript which loads the > variable into the form, but the variable name and value needs to be known at > the time. > > Here is some sample code which loads the value when the " Send " button is > clicked. > > You will probably want to do something else with the value rather than just > display it, but this demonstrates that it works. > > <html> > <head> > <title>Form Test</title> > <script type="text/javascript"> > var fred ="abcd123"; /* global variable */ > > function doit() > {document.form1.test.value=fred;} > </script> > </head> > <body> > <form name="form1"> > <input type="text" id="test" /> > <input type="button" value=" Send " onclick="doit()" /> > </form> > </body> > </html> > -- > Trevor Lawrence > Canberra > Web Sitehttp://trevorl.mvps.org Thanks but I am having trouble structuring it correctly because of where the script is/isn't. Yes, I meant javascript. Here is a portion of my page: Note: getvalue function gets the value of 'fullname' out of the url and works fine. <html> <head> <title>Test Form</title> <script type="text/javascript"> function getValue(varname) //rest of the function is here return value; </script> </head> <form method="POST" name="Contact Us" action="--WEBBOT-SELF--" onSubmit="location.href='_derived/nortbots.htm';return false;" webbot- onSubmit="return checkform(this);"> <!--webbot bot="SaveResults" S-Email-Format="TEXT/PRE" S-Email- Address="webmaster(a)xxyyzz.org" B-Email-Label-Fields="TRUE" B-Email- ReplyTo-From-Field="TRUE" S-Email-ReplyTo="replyemail" B-Email-Subject- From-Field="FALSE" S-Email-Subject="Email Address Found" S-Builtin- Fields startspan U-Confirmation-Url="confirmation.htm" --> <!--webbot bot="SaveResults" endspan --> // how do I get getvalue("fullname") into the above results? YES! I know the email address for: <p> <script type="text/javascript"> var NeedName = getValue("fullname"); document.write(NeedName); </script> </p> <p> Here is their email address <input name="MissingEmail" size="40"></p> <p>Enter their email address again to confirm <input name="EmailConfirm" size="40"></p> <p>MY name is <input name="SenderName" size="40"></p> <p>MY email address is <input name="replyemail" size="40"></p> <p> <input type="submit" value="Submit" name="submit" </form> </body> </html>
From: "Trevor Lawrence" Trevor on 15 Jul 2008 00:37 > <jorabi1(a)gmail.com> wrote in message > news:119824eb-7e16-483f-b314-8c75d06d9609(a)b1g2000hsg.googlegroups.com... > Thanks but I am having trouble structuring it correctly because of > where the script is/isn't. Yes, I meant javascript. Here is a > portion of my page: > Note: getvalue function gets the value of 'fullname' out of the url > and works fine. > [snip of code] I am confused. You have this "comment" (It isn't an HTML comment as such - this would need to be enclosed in <!-- -->): > // how do I get getvalue("fullname") into the above results? My question is where do you want to place getvalue("fullname") ? Do you want it in "MissingEmail"? I notice this code: <form method="POST" name="Contact Us" action="--WEBBOT-SELF--" onSubmit="location.href='_derived/nortbots.htm';return false;" webbot- onSubmit="return checkform(this);"> As far as I can tell (and I use http://www.w3schools.com/ as my reference) this code does this when Submit is pressed: First execute the javascript after onSubmit= Then call the ASP file named after action= (which is NOT a file) I have no idea what it does with webbot-onsubmit= So what I oginally wrote was simpler code that inserts a value into the form. I have now enclosed some code adapted from yours. For testing, I needed a value for the variable value, so I hard coded it to "name(a)domain.com". The next line places the value of value into the form. (Note that the variable name "value" is not a good choice, but it does work.) Because getValue() needs to be executed, I added onload ="getValue()" to the body tag. Does it need to be executed somewhere else? I understand that you don't want to send the contents of the form to an ASP file, so I don't have an method="POST", but instead I have <form name="form1" action="" onsubmit="doit()"> You will need to write the function named doit() to do what you want with the contents of the form. If it is to send an email back to yourself, this can be done, using the viewer's installed email client. I have written this code in doit(). Am I on the right track for what you want ? If not, please give me more info. Code follows <html> <head> <title>Test Form</title> <script type="text/javascript"> function getValue(varname) { /* rest of the function is here */ /* this line for testing only */ var value = "name(a)domain.com"; document.form1.MissingEmail.value=value; } function doit() { var subject = "Response from my page" var body = "The sender's email was " location.href='mailto:me(a)mydomain.com' + '?subject=' + subject + '&body=' + body + document.form1.MissingEmail.value } </script> </head> <body onload="getValue()"> <form name="form1" action="" onsubmit="doit()"> <p>Here is their email address <input name="MissingEmail" size="40"></p> <p>Enter their email address again to confirm <input name="EmailConfirm" size="40"></p> <p>MY name is<input name="SenderName" size="40"></p> <p>MY email address is<input name="replyemail" size="40"></p> <p><input type="submit" value="Submit" name="submit"></p> </form> </body> </html> -- Trevor Lawrence Canberra Web Site http://trevorl.mvps.org
|
Next
|
Last
Pages: 1 2 Prev: Layout of website is not flawless in Firefox and Netscappe Next: Cheap Discount Prada Chanel LV Chloe Hermes Guess Dior Wallet, Fendi Wallet, Coach Purse, Juicy Purse, Miumiu G U C C I handbags Leather bags Discount Miumiu Leather bags MiuMiu coffee miu miu miu miu woven hobo handbags Designer Handbags |