Not everything here is for backward compatibility. popup, fade,
collapse and ajax are because one should use the equivalent jquery
functions. The rest is necessary to have effects on forms (like the
sliding erros, datepicker, clock) and real-time client side validation
of forms.



On Nov 5, 9:33 am, annet <[EMAIL PROTECTED]> wrote:
> Denes,
>
> Thanks for your reply. One more question though, web2py_ajax.html
> contains the following <script></script> element:
>
> <script type="text/javascript"><!--
> function popup(url) {
>   newwindow=window.open(url,'name','height=400,width=600');
>   if (window.focus) newwindow.focus();
>   return false;}
>
> function collapse(id) { $('#'+id).slideToggle(); }
> function fade(id,value) { if(value>0) $('#'+id).hide().fadeIn('slow');
> else $('#'+id).show().fadeOut('slow'); }
> function ajax(u,s,t) {
>   var query="";
>   for(i=0; i<s.length; i++) {
>      if(i>0) query=query+"&";
>      query=query+encodeURIComponent(s[i])
> +"="+encodeURIComponent(document.getElementById(s[i]).value);
>   }
>   $.ajax({type: "POST", url: u, data: query, success: function(msg)
> { document.getElementById(t).innerHTML=msg; } });}
>
> String.prototype.reverse = function () { return
> this.split('').reverse().join('');};
> $(document).ready(function() {
> $('.hidden').hide();
> $('.error').hide().slideDown('slow');
> $('.flash').hide().slideDown('slow')
> $('.flash').click(function() { $(this).fadeOut('slow'); return
> false; });
> $('input.string').attr('size',50);
> $('textarea.text').attr('cols',50).attr('rows',10);
> $('input.integer').keyup(function()
> {this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/
> g,'').reverse();});
> $('input.double').keyup(function()
> {this.value=this.value.reverse().replace(/[^0-9\-\.]|[\-](?=.)|[\.](?
> =[0-9]*[\.])/g,'').reverse();});
> $('input.delete').attr('onclick','if(this.checked) if(!
> confirm("{{=T('Sure you want to delete this object?')}}"))
> this.checked=false;');
> try {$("input.date").focus( function() {Calendar.setup({
>      inputField:this.id, ifFormat:"{{=T('%Y-%m-%d')}}",
> showsTime:false}); }); } catch(e) {};
>
> try { $("input.datetime").focus( function() {Calendar.setup({
>      inputField:this.id, ifFormat:"{{=T('%Y-%m-%d %H:%M:%S')}}",
> showsTime: true,timeFormat: "24"}); }); } catch(e) {};
>
> try { $("input.time").clockpick({
>      starthour:0, endhour:23, showminutes:true, military:true}); } catch(e) 
> {};
> });
>
> //--></script>
>
> I read it's there for backward compatibility, however, I never
> wondered what that meant (I started working with web2py from version
> 1.42).
>
> Does web2py do something with the functions inside this element, the
> content is displayed in a gray color, so I guess not, until you remove
> the <!-- --> part. Will I run into trouble when I remove the <!-- -->
> and all the functions inside this element except the $
> (document).ready(function() {}) and insert the $
> ('#example').dataTable(); in there.
>
> Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to