Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Javascript / Client Side Development

Automatic onsubmit?


<form onsubmit="call_rss();return false;">
  <input type="text" name="rssurl" id="rssurl" size="40"
value='Skype'>
</form>

The code above has the value "Skype" and only after hitting Enter/
Return key, the value is submitted. How can the value "Skype" be
submitted automatically without pressing Enter/Return key?

Thanks for the tips, gurus :)

Andy said the following on 5/17/2007 1:12 PM:

> <form onsubmit="call_rss();return false;">
>   <input type="text" name="rssurl" id="rssurl" size="40"
> value='Skype'>
> </form>

> The code above has the value "Skype" and only after hitting Enter/
> Return key, the value is submitted. How can the value "Skype" be
> submitted automatically without pressing Enter/Return key?

You could start by asking the same question twice in 3 minutes.

window.onload = submitTheForm

function submitTheForm(){
document.forms['theForm'].submit()

}

And give your form a name attribute of "theForm"

P.S. It would be better to use return call_rss() and have call_rss
return true or false.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

Randy & Tom, here's actual code:

-----------------------------------------------
<?php
  include "rss/rss.php";

  function quote ($com) {
    $client = new SoapClient("http://services.xmethods.net/soap/
urn:xmethods-delayed-quotes.wsdl");
    return $client->getQuote($com);
  }

  include_once("agent.php");

?>

<?php
  $agent->init();
?>

<script>

  function call_rss() {
    str = document.getElementById('rssurl').value;
    agent.call('','rss','callback_rss','http://news.search.yahoo.com/
news/rss?p='+str);
  }

  function callback_rss(str) {
    document.getElementById('div_rss').innerHTML = str;
  }

</script><head>
<link href="style.css" rel="stylesheet" type="text/css" />

</head>

<b>AJAX AGENT Demo Portal</b><br/><br/>

<table width="383">
  <tr align=left valign=top>
    <td width="860">

      <table>
        <!-- portlet begins -->
        <tr align=left valign=top bgcolor=#ddeeff>
          <td width="375"><b>RSS Search</b></td>
        </tr>
        <tr align=left valign=top>
          <td colspan=2><br/>
<form onsubmit="call_rss();return false;">
  <input type="text" name="rssurl" id="rssurl" size="40"
value='Skype'>
</form> <br/>
<div id='div_rss'></div>          </td>
        </tr>
        <tr align=left valign=top><td>&nbsp;</td></tr>
        <!-- portlet ends -->
      </table>      </td>
  </tr>
</table>
<p>&nbsp;</p>

<p>&nbsp;</p>

-----------------------------------------------

As you can see, I want "Skype" to be submitted automatically.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc