Hi All,
my client uses a third-party newsletter solution which generates the HTML code of a Form on which the users can subscribe themselves.
My problem is that this script contains JavaScript for data validation. Placing this in a HTML module it does not work. Can you please, give me some suggestions how could I make it work?
Why don't I use a DNN module that deals with Forms?
Because I could not find any in which
- I can set the name tag for the particular Form field: <input type="text" name="f_3" />
- I can set the action URL in for the Form.
Here is the form's script:
<form id="subscribe_form" method="post" action="http://[URL].hu/">
<table border="0" cellspacing="0" cellpadding="4">
<tr>
<td align="right" width="50%">Name:<font color="red">*</font></td>
<td width="50%">
<input type="text" name="name" />
</td>
</tr>
<tr>
<td align="right">E-mail:<font color="red">*</font></td>
<td>
<input type="text" name="subscr" />
</td>
</tr>
<tr>
<td align="right">call sign:</td>
<td>
<input type="text" name="f_2" />
</td>
</tr>
<tr>
<td align="right">name of your firm:</td>
<td>
<input type="text" name="f_3" />
</td>
</tr>
<tr>
<td align="right">address:</td>
<td>
<input type="text" name="f_4" />
</td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" name=sub value="Subscribe" onClick="if(!fvalidate_2('feliratkozo_form_2')) return false;" /></td>
</tr>
</table>
</form>
<!-- WebGalamb Hírlevélkód - form vége
JavaScript ellenőrző kód eleje -->
<script type="text/javascript">function fvalidate_2(fname){var formx=document.getElementById(fname);var hiba='';var mregexp=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(!mregexp.test(formx.subscr.value)){hiba='* Hibás a megadott e-mail cím!';formx.subscr.focus();}if(!formx.name.value){hiba+=(hiba?"\n":'')+'* Nincs megadva a név!';formx.name.focus();}if(hiba) hiba); else return true;}</script>
<!-- JavaScript ellenőrző kód vége -->