Silkroad Online Forums

A community forum for the free online game Silkroad Online. Discuss Silkroad Online, read up on guides, and build your character and skills.

Faq Search Members Chat  Register Profile Login

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Form Scripting problem, help please!
PostPosted: Sat Jan 03, 2009 5:13 pm 
Elite Member
User avatar
Offline

Joined: Apr 2007
Posts: 6431
Location: ┌(╬ಠ益ಠ)╯( ̄ー ̄)(ノ◕ヮ◕)ノ:・✧(╯°Д°)╯彡┻━┻ψ(`∇´)ψ(☞゚∀゚)☞¯\_(ツ)_/¯ლ(ಥ益ಥლ)ԅ༼ ◔ڡ◔༽งヽ༼ʘ̚ل͜ʘ̚༽ノᕕ(ᐛ)ᕗ( ͡° ͜ʖ ͡°)
ok, this is the final part i need to have for my site.
i can't get it to check whether the form has been filled in or not...


Code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body> <script type="text/javascript">
function testform()
{
if(document.forms[0].elements[0].value==""
|| document.forms[0].elements[1].value=="none"
|| document.forms[0].elements[2].value==""
|| document.forms[0].elements[3].value==""
|| document.forms[0].elements[4].value=="")
  {
   alert("You must fill in all the information in this form")
   }
}
</SCRIPT>


<form>
<tr>
  <td>Please enter your Name</td><br>
  <td><input type="text" name="Name" size="50" maxlength="35" /></td>
</tr>
<br><br>
<tr>
  <td>What is your age?</td><br>
  <td>
   <select name="age">
    <option>none</option
    <option>5 </option>
    <option>6 </option>
    <option>7 </option>
    <option>8 </option>
    <option>9 </option>
   <option>10 </option>
    <option>11 </option>
   <option>12</option>
   <option>13</option>
   <option>14</option>
    <option>15 </option>
    <option>16 </option>
    <option>17 </option>
    <option>18 </option>
    <option>19 </option>
    <option>20 </option>
    <option>older than 20 </option>
    </select>
</td>
</tr>
<br><br>
<tr>
  <td valign="top">What is your favorite Character</td><br>
  <td>
   <input type="radio" name="character" value="Sonic" />Sonic
    <input type="radio" name="character" value="Knuckles" />Knuckles
    <input type="radio" name="character" value="Tails" />Tails
    <input type="radio" name="character" value="Shadow" />Shadow
    <input type="radio" name="character" value="Rouge" />Rouge
    <input type="radio" name="character" value="Eggman" />Eggman
    <input type="radio" name="character" value="Omega" />Omega
    <input type="radio" name="character" value="Metal" />Metal

  </td>
</tr>
<br><br>

<tr>
  <td valign="top">What are your favorite games?</td><br>
  <td>
   <input type="checkbox" name="game" value="Sonic 2D games" />Sonic 2D games<br />
   
    <input type="checkbox" name="game" value="Sonic Adventure 1" />Sonic Adventure 1<br />
    <input type="checkbox" name="game" value="Sonic Adventure 2" />Sonic Adventure 2<br />
      <input type="checkbox" name="game" value="Sonic Heroes" />Sonic Heroes<br />
      <input type="checkbox" name="game" value="Sonic the hedgehog 2006" />Sonic the hedgehog 2006<br />
      <input type="checkbox" name="game" value="Shadow the Hedgehog" />Shadow the Hedgehog<br />
    <input type="checkbox" name="game" value="Sonic and the Secret Rings" />Sonic and the Secret Rings<br />
      <input type="checkbox" name="game" value="Sonic Unleashed" />Sonic Unleashed<br />
</td>
</tr>
<br>
<tr>
  <td><button type="reset">Reset</button></td>
   
   
  <td><INPUT TYPE="button" VALUE="send e-mail" onClick="self.location='mailto:SonicDX_Adventure@Hotmail.com';"></td>
   

   
   
   <form action=mailto:Sonicdx_adventure@hotmail.com method="Email" name="form"></script>
</tr>

</form>
</body>
</html>




if anyone can help, it is greatly appreciated, with this done i can finally rest a bit T__T

edit:
i got the basics fro this site
http://www.geocities.com/sunsetstrip/al ... .htm#sec23

_________________
Image
Day[9] wrote:
"Tea is a lot like gold expansions - it helps you kill people."
- Day[9] Daily 337 -


Top
 Profile  
 
 Post subject: Re: Form Scripting problem, help please!
PostPosted: Sat Jan 03, 2009 5:29 pm 
Active Member
User avatar
Offline

Joined: Mar 2007
Posts: 572
Location:
Hercules
you must link your submit-button with your "check"-function (testform())

_________________
DJ_Ettem - [ExcalibuR * ZoomZoom] ~ Lvl 95 ~ Pure STR Secret-build
FeelThePain - [SquadBlack] ~ Lvl 71 ~ Rogue
--> Hercules
Dutch_Legend Union TaxiTool (v.1.1)
http://www.silkroadforums.com/viewtopic.php?f=2&t=104027


Top
 Profile  
 
 Post subject: Re: Form Scripting problem, help please!
PostPosted: Sat Jan 03, 2009 5:36 pm 
Elite Member
User avatar
Offline

Joined: Apr 2007
Posts: 6431
Location: ┌(╬ಠ益ಠ)╯( ̄ー ̄)(ノ◕ヮ◕)ノ:・✧(╯°Д°)╯彡┻━┻ψ(`∇´)ψ(☞゚∀゚)☞¯\_(ツ)_/¯ლ(ಥ益ಥლ)ԅ༼ ◔ڡ◔༽งヽ༼ʘ̚ل͜ʘ̚༽ノᕕ(ᐛ)ᕗ( ͡° ͜ʖ ͡°)
mind explaining how?

_________________
Image
Day[9] wrote:
"Tea is a lot like gold expansions - it helps you kill people."
- Day[9] Daily 337 -


Top
 Profile  
 
 Post subject: Re: Form Scripting problem, help please!
PostPosted: Sat Jan 03, 2009 5:40 pm 
Active Member
User avatar
Offline

Joined: Mar 2007
Posts: 572
Location:
Hercules
I'm not really familiar with your language, but I can see that you didn't use your function (above) in the source from the onClick-event (button) (could also be the formaction thingy)

_________________
DJ_Ettem - [ExcalibuR * ZoomZoom] ~ Lvl 95 ~ Pure STR Secret-build
FeelThePain - [SquadBlack] ~ Lvl 71 ~ Rogue
--> Hercules
Dutch_Legend Union TaxiTool (v.1.1)
http://www.silkroadforums.com/viewtopic.php?f=2&t=104027


Top
 Profile  
 
 Post subject: Re: Form Scripting problem, help please!
PostPosted: Sat Jan 03, 2009 5:50 pm 
Forum God
User avatar
Offline

Joined: Aug 2006
Posts: 8834
Location: Age of Wushu
in function testform, add:
Code:
else self.location='mailto:SonicDX_Adventure@Hotmail.com';


at the bottom:
Code:
<td><INPUT TYPE="button" VALUE="send e-mail" onClick="testform();"></td>


there is an error, you open with a form and close with a script tag:
Code:
<form action=mailto:Sonicdx_adventure@hotmail.com method="Email" name="form"></script>


All inputs should be put in form. The code above should be put at the top where starts the first form

The send button should be input type submit (if you want to send the data to other page, otherwise you don't need form tag)

forms[0] and elements[0] can be replaced by their name or id to easier to keep track:
Code:
document.form.Name.value==""

_________________
Playing Age of Wushu, dota IMBA


Top
 Profile  
 
 Post subject: Re: Form Scripting problem, help please!
PostPosted: Sat Jan 03, 2009 8:23 pm 
Elite Member
User avatar
Offline

Joined: Apr 2007
Posts: 6431
Location: ┌(╬ಠ益ಠ)╯( ̄ー ̄)(ノ◕ヮ◕)ノ:・✧(╯°Д°)╯彡┻━┻ψ(`∇´)ψ(☞゚∀゚)☞¯\_(ツ)_/¯ლ(ಥ益ಥლ)ԅ༼ ◔ڡ◔༽งヽ༼ʘ̚ل͜ʘ̚༽ノᕕ(ᐛ)ᕗ( ͡° ͜ʖ ͡°)
well I got somewhere with the help of Vandango, but he's playing medieval now...

currently it notices everything. but when you make it submit it looks for page named after my email. help please...

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<script type="text/javascript">
function disp_alert()

{

if (form.name.value == "")
   
   {
          alert( "Please enter your name." );
            form.action = "form.htm"
   }

}


</script>
<form name="form" action="Sonicdx_adventure@hotmail.com" method="post" onsubmit ="return disp_alert();">
<tr>
  <td>Please enter your Name</td><br>
  <td><input type="text" name="name" size="50" maxlength="35" /></td>
</tr>
<br><br>
<tr>
  <td>What is your age?</td><br>
  <td>
   <select name="age">
    <option>5 </option>
    <option>6 </option>
    <option>7 </option>
    <option>8 </option>
    <option>9 </option>
   <option>10 </option>
    <option>11 </option>
   <option>12</option>
   <option>13</option>
   <option>14</option>
    <option>15 </option>
    <option>16 </option>
    <option>17 </option>
    <option>18 </option>
    <option>19 </option>
    <option>20 </option>
    <option>older than 20 </option>
    </select>
</td>
</tr>
<br><br>
<tr>
  <td valign="top">What is your favorite Character</td><br>
  <td>
   <input type="radio" name="character" value="Sonic" checked="checked" />Sonic
    <input type="radio" name="character" value="Knuckles" />Knuckles
    <input type="radio" name="character" value="Tails" />Tails
    <input type="radio" name="character" value="Shadow" />Shadow
    <input type="radio" name="character" value="Rouge" />Rouge
    <input type="radio" name="character" value="Eggman" />Eggman
    <input type="radio" name="character" value="Omega" />Omega
    <input type="radio" name="character" value="Metal" />Metal

  </td>
</tr>
<br><br>

<tr>
  <td valign="top">What are your favorite games?</td><br>
  <td>
   <input type="checkbox" name="game" value="Sonic 2D games" />Sonic 2D games<br />
   
    <input type="checkbox" name="game" value="Sonic Adventure 1" />Sonic Adventure 1<br />
    <input type="checkbox" name="game" value="Sonic Adventure 2" />Sonic Adventure 2<br />
      <input type="checkbox" name="game" value="Sonic Heroes" />Sonic Heroes<br />
      <input type="checkbox" name="game" value="Sonic the hedgehog 2006" />Sonic the hedgehog 2006<br />
      <input type="checkbox" name="game" value="Shadow the Hedgehog" />Shadow the Hedgehog<br />
    <input type="checkbox" name="game" value="Sonic and the Secret Rings" />Sonic and the Secret Rings<br />
      <input type="checkbox" name="game" value="Sonic Unleashed" />Sonic Unleashed<br />
</td>
</tr>
<br>
<tr>
  <td><button type="reset">Reset</button></td>
  <td><button type="submit">Send</button></td><form method="post" name="btnName" onClick ="disp_alert()">
</tr>

</form>
</body>
</html>

_________________
Image
Day[9] wrote:
"Tea is a lot like gold expansions - it helps you kill people."
- Day[9] Daily 337 -


Top
 Profile  
 
 Post subject: Re: Form Scripting problem, help please!
PostPosted: Sat Jan 03, 2009 10:31 pm 
Forum God
User avatar
Offline

Joined: Aug 2006
Posts: 8834
Location: Age of Wushu
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<script type="text/javascript">
function disp_alert()
{
        var name=document.getElementById("name").value;
        if (name=="") {
                alert("Enter name");
        }
        else {
                window.location="mailto:SonicDX_Adventure@Hotmail.com?subject=Test mail&cc=partenaire@antonio.net&bcc=avocat@antonio.net&body=Hi, how are you?%0D%0AYour name is : "+name;
        }
}
</script>
<form id="form">
<tr>
  <td>Please enter your Name</td><br>
  <td><input type="text" name="name" id="name" size="50" maxlength="35" /></td>
</tr>
<br><br>
<tr>
  <td>What is your age?</td><br>
  <td>
   <select name="age">
   <option>None</option>
    <option>5 </option>
    <option>6 </option>
    <option>7 </option>
    <option>8 </option>
    <option>9 </option>
   <option>10 </option>
    <option>11 </option>
   <option>12</option>
   <option>13</option>
   <option>14</option>
    <option>15 </option>
    <option>16 </option>
    <option>17 </option>
    <option>18 </option>
    <option>19 </option>
    <option>20 </option>
    <option>older than 20 </option>
    </select>
</td>
</tr>
<br><br>
<tr>
  <td valign="top">What is your favorite Character</td><br>
  <td>
   <input type="radio" name="character" value="Sonic" />Sonic
    <input type="radio" name="character" value="Knuckles" />Knuckles
    <input type="radio" name="character" value="Tails" />Tails
    <input type="radio" name="character" value="Shadow" />Shadow
    <input type="radio" name="character" value="Rouge" />Rouge
    <input type="radio" name="character" value="Eggman" />Eggman
    <input type="radio" name="character" value="Omega" />Omega
    <input type="radio" name="character" value="Metal" />Metal
    <input type="radio" name="character" value="Other" checked="checked"/>Other

  </td>
</tr>
<br><br>

<tr>
  <td valign="top">What are your favorite games?</td><br>
  <td>
   <input type="checkbox" name="game" value="Sonic 2D games" />Sonic 2D games<br />
   
    <input type="checkbox" name="game" value="Sonic Adventure 1" />Sonic Adventure 1<br />
    <input type="checkbox" name="game" value="Sonic Adventure 2" />Sonic Adventure 2<br />
      <input type="checkbox" name="game" value="Sonic Heroes" />Sonic Heroes<br />
      <input type="checkbox" name="game" value="Sonic the hedgehog 2006" />Sonic the hedgehog 2006<br />
      <input type="checkbox" name="game" value="Shadow the Hedgehog" />Shadow the Hedgehog<br />
    <input type="checkbox" name="game" value="Sonic and the Secret Rings" />Sonic and the Secret Rings<br />
      <input type="checkbox" name="game" value="Sonic Unleashed" />Sonic Unleashed<br />
</td>
</tr>
<br>
<tr>
  <td><button type="reset">Reset</button></td>
  <td><button type="button" onClick="disp_alert()">Send</button></td>
</tr>

</form>
</body>
</html>

_________________
Playing Age of Wushu, dota IMBA


Top
 Profile  
 
 Post subject: Re: Form Scripting problem, help please!
PostPosted: Sat Jan 03, 2009 11:36 pm 
Elite Member
User avatar
Offline

Joined: Apr 2007
Posts: 6431
Location: ┌(╬ಠ益ಠ)╯( ̄ー ̄)(ノ◕ヮ◕)ノ:・✧(╯°Д°)╯彡┻━┻ψ(`∇´)ψ(☞゚∀゚)☞¯\_(ツ)_/¯ლ(ಥ益ಥლ)ԅ༼ ◔ڡ◔༽งヽ༼ʘ̚ل͜ʘ̚༽ノᕕ(ᐛ)ᕗ( ͡° ͜ʖ ͡°)
let the picture talk.


Attachments:
nuclearsiloskillz.JPG
nuclearsiloskillz.JPG [ 30.05 KiB | Viewed 1383 times ]

_________________
Image
Day[9] wrote:
"Tea is a lot like gold expansions - it helps you kill people."
- Day[9] Daily 337 -
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group