Also, a tip -- if you think web2py is causing a problem with your code, try 
the code in a page not served by web2py (e.g., just a static HTML page), 
and see if it works.

Anthony

On Friday, August 24, 2012 7:29:16 AM UTC-4, Anthony wrote:
>
> Yes, web2py supports Javascript functions (you can do whatever you want on 
> the client side). In a couple places, your code has the wrong kind of 
> quotes -- instead of " you have ”. In particular:
>
> onSubmit=”return textFieldValidation();”
>
> should be:
>
> onSubmit="return textFieldValidation();"
>
> and
>
> <SCRIPT LANGUAGE=”javascript”>
>
> should be:
>
> <SCRIPT LANGUAGE="javascript">
>
> Actually, the language attribute has been deprecated -- so it should 
> really just be:
>
> <script>
>
> Anthony
>
> On Friday, August 24, 2012 2:35:52 AM UTC-4, Amit wrote:
>>
>> Hi,
>> I have html file with one text field with submit button inside form.I 
>> added javascript code to validate the textfield but its not working at all, 
>> why is it so? does web2py not support javascript function?
>>
>> please check below the code :
>>
>> <SCRIPT LANGUAGE=”javascript”>
>> function textFieldValidation()
>> {
>>     var x=document.forms["text_form"]["test_textField"].value
>>     if (x==null || x==""||x=="00:00:00:00:00:00")
>>       {
>>           alert("text field should not be empty");
>>           return false;
>>       }
>> }
>> </SCRIPT>
>>
>>
>> In form tag:
>>
>> <form method="post" name="text_form" onSubmit=”return textFieldValidation
>> ();”>
>> <table>
>> <tr>
>>           <td align="middle">Enter value:</td>
>>           <td align="left"><input value="00:00:00:00:00:00" maxlength=
>> "17" 
>>             name=test_textField></td></tr>
>>
>> <tr>
>>     <td 
>> align=middle><input value="Continue" type="Submit" name="Continue" 
>> ></td></tr>
>> </table>
>> </form>
>>
>>
>>
>>

-- 



Reply via email to