How to populate a blank form field with onSubmit
<p>New to JavaScript so please forgive my ignorance.</p>

<p>I have a form where when the customer submits the form it checks a specific field and if it's left blank I need it to populate it with a specific code. Any ideas how I can do this?</p>

<pre><code>&lt;form method="post" action="index.php" name="checkout"&gt;

&lt;table width="100%" border="0" cellpadding="5" cellspacing="10"&gt;
 &lt;tr&gt;
  &lt;td align="right" class="normaltext" width="40%"&gt;
   &lt;b&gt;Catalog Code:&lt;/b&gt;
  &lt;/td&gt;
  &lt;td align="left"&gt;
   &lt;input type="text" name="cat_code" value="{$valid.cat_code}" size="25" class="formtext" /&gt;
  &lt;/td&gt;
 &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>Then the submit button:</p>

<pre><code>&lt;input type="submit" name="submit" value="Continue &amp;gt;" class="addtocart_btn btnstyle1" /&gt;
</code></pre>
