[web2py] controller not returning java script variable correctly

2014-01-15 Thread jonas
Hi I have a controller that is supposed to return a list to a js function (for testing purposes): def test(): print called2 data=[3, 6, 2, 7, 5, 2, 0, 3, 8, 9, 2, 5, 9, 3, 6, 3, 6, 2, 7, 5, 2, 1, 3, 8, 9, 2, 5, 9, 2, 7] return 'var data=%s;' % data I am calling this with an

Re: [web2py] Re: controller not returning java script variable correctly

2014-01-15 Thread Jonas Fredriksson
will be executed before the ajax call has completed. Try putting the document.write() in the returned Javascript itself. On Wednesday, January 15, 2014 11:09:04 AM UTC-5, jonas wrote: Hi I have a controller that is supposed to return a list to a js function (for testing purposes): def test

Re: [web2py] Re: controller not returning java script variable correctly

2014-01-15 Thread Jonas Fredriksson
nice solution and it works. thanks On Wed, Jan 15, 2014 at 7:34 PM, Anthony abasta...@gmail.com wrote: graph1 is the actual function, the write function was just for testing. This works but it means that I have to make a python function for every js function call when passing values from

Re: [web2py] calling custom javascript functions

2014-01-12 Thread Jonas Fredriksson
I just wanted to see if it's possible to call custom made js functions using jQuery. I found that it is possible to call by using this function: $(document).ready(function() { $(function_call()); } css tags can also be added. but it is simpler to just use myfunction(); In the web2py book

Re: [web2py] calling custom javascript functions

2014-01-12 Thread Jonas Fredriksson
yes, and it works. thanks On Sun, Jan 12, 2014 at 3:08 PM, Anthony abasta...@gmail.com wrote: Did you try: $(document).ready(function() { myfunction(); }); Anthony On Sunday, January 12, 2014 3:48:48 AM UTC-5, jonas wrote: I just wanted to see if it's possible to call custom made

[web2py] calling custom javascript functions

2014-01-11 Thread jonas
hi I have developed javascript functions in /static/js/custom/charts.js they are loaded in layout.html: script src={{=URL('static','js/custom/charts.js')}}/script I call them in index.html by: script myfunction(); /script I know that ajax and jQuery can be used to call python functions in

Re: [web2py] Re: links in texts stoded in a database

2013-12-30 Thread Jonas Fredriksson
the XML function solved the problem: {{for i, row in enumerate(rows):}} {{=DIV(XML(T(row.table_field), sanitize = True) ) }} {{pass}} thanks. On Mon, Dec 30, 2013 at 3:29 AM, 黄祥 steve.van.chris...@gmail.com wrote: another way around is define it on the represent for your table text field.

Re: [web2py] Re: links in texts stoded in a database

2013-12-29 Thread Jonas Fredriksson
just to clarify, my problem is that html tags in my input text area is just rendered as tags, naturally because the field is classified as text and nothing else. I need to render the html elements when displaying text. On Fri, Dec 27, 2013 at 10:01 PM, Jonas Fredriksson jonas...@gmail.comwrote

Re: [web2py] Re: links in texts stoded in a database

2013-12-27 Thread Jonas Fredriksson
I tried ckeditor and I've got an editor in admin so I can insert links, so far so good. but the text is still rendered plain with html tags visible. my function and db in db.py: (text field is the field I want to insert links into) def advanced_editor(field,text): return TEXTAREA(_id =

[web2py] links in texts stoded in a database

2013-12-24 Thread jonas
Hi How do you put links to other sites in a text that is stored in a database? for example, I have a blogg where all coments, posts etc are stored in a database. Everytime I add a post I do it from the admin interface by adding new entries in the database. But adding a link in the text is not

Re: [web2py] Re: anyone tried jQuery svg?

2013-01-08 Thread Jonas Fredriksson
it into a document.ready function or something. On Sunday, January 6, 2013 2:14:13 PM UTC, jonas wrote: Hi. Has anyone here tried the jQuery svg lib http://keith-wood.name/svg.html? I tried to use it in web2py but with no success. the necessary lib was imported: script src={{=URL('static','js

[web2py] anyone tried jQuery svg?

2013-01-06 Thread jonas
Hi. Has anyone here tried the jQuery svg lib http://keith-wood.name/svg.html? I tried to use it in web2py but with no success. the necessary lib was imported: script src={{=URL('static','js/jquery/jquery.svg.js')}}/script but is seems that the svg function is not present : div

[web2py] jQuery function not working in index.html

2013-01-05 Thread jonas
Hi when using the following functions in index.html only the last one works: {{extend 'layout.html'}} h2index.html/h2 div class=one id=aHello 2/d div class=two id=bWorld 2/d script jQuery('.one').click(function(){ jQuery('.two').slideToggle() }); /script div class=one id=a

[web2py] Re: jQuery function not working in index.html

2013-01-05 Thread jonas
solved the problem, missing /div closing statement, although I think that was included in the real code On Saturday, January 5, 2013 3:23:00 PM UTC+1, jonas wrote: Hi when using the following functions in index.html only the last one works: {{extend 'layout.html'}} h2index.html/h2 div

[web2py] generating svg from controllers

2012-12-26 Thread jonas
Hi. Is there any way to generate xml svg via controllers? svg can be made by using declarative syntax, i.e xml instead of javascript. is it possible to return an string containing svg xml and render it in index.html? for example, a very simple function, index.py: def index(): a=circle

[web2py] Re: generating svg from controllers

2012-12-26 Thread jonas
, December 26, 2012 1:52:54 PM UTC-5, jonas wrote: Hi. Is there any way to generate xml svg via controllers? svg can be made by using declarative syntax, i.e xml instead of javascript. is it possible to return an string containing svg xml and render it in index.html? for example, a very simple

Re: [web2py] Re: controller not returning variables

2012-12-24 Thread Jonas Fredriksson
ok, to include everything in the for loop is more elegant. The reason why I wanted to separate the call to sidebar.py is that the sidebar contains almost static material that doesn't change that much, while the main page (index page) has content that changes more. In the first version I had the db

Re: [web2py] Re: controller not returning variables

2012-12-23 Thread jonas
class=icon-check/i {{=pr}}/dd /dl {{pass}} h5i class=icon-arrow-right/i Contact: {{=pre.contact}}/h5 {{pass}} but it would have been better to return the ab dict from the sidebar.py controller instead. On Saturday, December 22, 2012 11:24:11 PM UTC, jonas wrote: ok. thanks

[web2py] controller not returning variables

2012-12-22 Thread jonas
this is probably simple but I post it anyway I have a layout that includes sidebar.html: section id=main class=main row br br div class=span2 left-sidebar offset1 !-- div class=headerDivider/div -- {{block left_sidebar}} {{include 'default/sidebar.html'}} {{end}}

Re: [web2py] Re: controller not returning variables

2012-12-22 Thread Jonas
their own controller functions. Anthony On Saturday, December 22, 2012 3:11:38 PM UTC-5, jonas wrote: this is probably simple but I post it anyway I have a layout that includes sidebar.html: section id=main class=main row br br div class=span2 left-sidebar

Re: [web2py] Re: controller not returning variables

2012-12-22 Thread jonas
ok. thanks, that clarified the a few things. On Saturday, December 22, 2012 10:48:35 PM UTC, Anthony wrote: On Saturday, December 22, 2012 5:00:52 PM UTC-5, jonas wrote: Ok, I have a {{include}} statement in the beginning of the layout.html file that cals index.html and the corresponding

Re: [web2py] Re: custom form validation doesn't work

2012-12-16 Thread Jonas Fredriksson
that the submission was successful and possible collapsed to. It is true that the redirect(index) returns data from the data base but I want to avoid that in this case, so another form of redirect would be better. On Sun, Dec 16, 2012 at 3:35 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Hello Jonas

Re: [web2py] Re: custom form validation doesn't work

2012-12-16 Thread Jonas Fredriksson
-6, jonas wrote: here is the custom form: {{=form.custom.begin}} div class=row h5date: /h5{{=form.custom.widget.created_on}} /div div class=row h5name: /h5{{=form.custom.widget.created_by}} /div div class=row h5mail: /h5{{=form.custom.widget.mail}} /div div class=row

Re: [web2py] Re: custom form validation

2012-12-15 Thread Jonas Fredriksson
ok. another thing is that if I use a regular form, {{=form}}, then validation works but not if I use the custom form. Also form.process() works, so the problem seems to be related to custom forms. On Sat, Dec 15, 2012 at 4:06 AM, Anthony abasta...@gmail.com wrote:

[web2py] custom form validation doesn't work

2012-12-15 Thread jonas
Hi. I have a default form that is passed in view: {{=form}} using this validation and insertion works. but when I use a custom form none of that works. why? Also form.process().accepted works only when using default form. My second question is: when submitting the form I redirect to index,

Re: [web2py] Re: calling LOAD from a button

2012-12-14 Thread Jonas Fredriksson
thanks I use the following solution; {{for result in res:}} h5{{=result.id}}/h5 h5{{=result.title}}/h5 {{=A(TAG.i(_class=icon-plus-sign), _rel=tooltip, _title=testing, _class=btn, _href='#', _onclick=jQuery('#uc').toggle();)}} div id=uc

[web2py] custom form validation

2012-12-14 Thread jonas
Hi I have a custom comment form: def comment(): create comment form. Every comment is id locked to the specific post #crud.settings.create_next = URL('index') post=db(db.blog.id==request.args(0)).select().first() db.comments.post_id.default=post.id

[web2py] calling LOAD from a button

2012-12-11 Thread jonas
Hi I have a link that redirects to a comment page: {{=A(TAG.i(_class=icon-pencil), _rel=tooltip, _title=give a comment, _class=btn, _href=URL('comment',args=result.id))} But I want to use LOAD instead of filling a form in a separate page:

[web2py] recursive error when including sidebar view

2012-12-10 Thread jonas
however, when I try to include the sidebar it gives recursive errors, and I cannot figure out why: Traceback (most recent call last): File /Users/jonas/Dropbox/web2py/gluon/main.py, line 538, in wsgibase serve_controller(request, response, session) File /Users/jonas/Dropbox/web2py/gluon

[web2py] Re: recursive error when including sidebar view

2012-12-10 Thread jonas
!) return dict(message=T('main')) now this works with {{include}} but if I change to {{include 'default/index.html}} then I get the same recursive error. is there something wrong with the path? On Monday, December 10, 2012 12:21:45 PM UTC+1, jonas wrote: HI I have two views that I want to have

[web2py] Re: recursive error when including sidebar view

2012-12-10 Thread jonas
ok, that solved the problem. Thanks On Monday, December 10, 2012 4:46:12 PM UTC+1, Anthony wrote: and in layout.html: section id=main class=main row {{if left_sidebar_enabled:}} br br div class=span2 left-sidebar offset1 !-- div class=headerDivider/div --

[web2py] callback question

2012-12-08 Thread jonas
Hi I still have some problems with callbacks. I have a like button that is in my index.html view that add 1 to a database, then displays it: a class=btn href={{=URL(plus,args=result.id)}} rel=tooltip title=you like thisi class=icon-thumbs-up/i/a I want to call the plus function as a callback

Re: [web2py] Re: callback question

2012-12-08 Thread Jonas Fredriksson
this, _class=btn, _href=URL(plus,args=result.id)) and you can turn it into a callback using A(TAG.i(_class=icon-thumbs-up), _rel=tooltip, _title=you like this, _class=btn, callback=URL(plus,args=result.id)) On Saturday, December 8, 2012 3:42:49 PM UTC+1, jonas wrote: Hi I still have some

Re: [web2py] Re: callback question

2012-12-08 Thread jonas
8, 2012 6:29:14 PM UTC+1, Niphlod wrote: maybe you'll be better off with a component (LOAD()) for that On Saturday, December 8, 2012 5:00:41 PM UTC+1, jonas wrote: Thanks, that solved the callback problem. now I just have to figure how to update part of the index.html view. On Sat, Dec 8

Re: [web2py] Re: callback question

2012-12-08 Thread jonas
)}} On Saturday, 8 December 2012 16:26:02 UTC-6, jonas wrote: LOAD looks interesting. trying to LOAD comment form but gets error (non-keyword arg after keyword arg) when using the following button: a class=btn href={{=LOAD('comment',args=result.id,'comment.load',ajax=True)}} rel=tooltip

Re: [web2py] Re: controller that don't returns a view?

2012-12-07 Thread Jonas Fredriksson
Thanks. Actually the call comes from a button: a class=btn href={{=URL(plus_minus,args=result.id)}} rel=tooltip title=you like thisi class=icon-thumbs-up/i/a It has to provide the right result.id so the like addition relates to the right post. I will try using callbacks from the button call to

[web2py] controller that don't returns a view?

2012-12-06 Thread jonas
hi I have a controller that basically inserts a number in a database. I don't want it to render any view. For now I just redirect back to index.html, but is there any other way to do it, i.e to have a controller that not renders any views? controller: def plus_minus(): add or

[web2py] Re: forms redirect and verification doesn't work

2012-12-05 Thread jonas
it to redirect, do: crud.settings.create_next = URL('index') as indicated in the book. Anthony On Sunday, December 2, 2012 4:15:51 PM UTC-5, jonas wrote: Hi. when using the code below redirect and verification doesn't work: def comment(): create comment form post=db

Re: [web2py] Re: forms redirect and verification doesn't work

2012-12-05 Thread Jonas Fredriksson
now it works, had to put everything in the right order: crud.settings.create_next = URL('index') post=db(db.blog.id==request.args(0)).select().first() db.comments.post_id.default=post.id form=crud.create(db.comments) Thanks again On Wed, Dec 5, 2012 at 12:55 PM, jonas jonas

[web2py] images not displayed when using img and URL

2012-12-05 Thread jonas
hi this is probably a trivial problem but I post it anyway: I have an image model: db.define_table('blog', Field('date','datetime',default=request.now), Field('image','upload'), Field('imageTitle','text',default=image text), Field('title','text'), Field('text','text')) #

Re: [web2py] Re: images not displayed when using img and URL

2012-12-05 Thread Jonas Fredriksson
('default', 'download', args=row.something) as a downloader of an 'upload' record. On Wednesday, December 5, 2012 6:41:58 PM UTC+1, jonas wrote: hi this is probably a trivial problem but I post it anyway: I have an image model: db.define_table('blog', Field('date','datetime',default=request.now

[web2py] forms redirect and verification doesn't work

2012-12-02 Thread jonas
Hi. when using the code below redirect and verification doesn't work: def comment(): create comment form post=db(db.blog.id==request.args(0)).select().first() db.comments.post_id.default=post.id form=crud.create(db.comments) if form.process().accepted: session.flash =

Re: [web2py] page min height

2012-11-22 Thread Jonas Fredriksson
Hi. I tried the link and more or less copied the code but the sticky footer don't work. especially the push seems not to work. here is my code: div id=wrap div class=container div class=page-header h1page header/h1 /div div class=row div class=span4h3span4/h3/div

Re: [web2py] page min height

2012-11-22 Thread jonas
) { #footer { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px;} } On Friday, November 23, 2012 12:04:31 AM UTC+1, jonas wrote: Hi. I tried the link and more or less copied the code but the sticky footer don't work

Re: [web2py] page min height

2012-11-22 Thread jonas
; padding-right: 20px;} } On Friday, November 23, 2012 12:04:31 AM UTC+1, jonas wrote: Hi. I tried the link and more or less copied the code but the sticky footer don't work. especially the push seems not to work. here is my code: div id=wrap div class=container div class

[web2py] difference between crud.select(db.hem,query) and db(query).select()?

2012-06-26 Thread Jonas Fredriksson
hi When doing results=crud.select(db.hem,query) I got a list containing the result with html tags in the beginning and the end. But I am not able to access different fields like result.info and so on. When I am using results=db(query).select() I can do results.info. Is there any way to get

[web2py] sidebar bug in 1.99.1?

2011-10-05 Thread Jonas Rundberg
Hi Using left or right sidebars in layout.html doesn't render the page as intended. (Using both sidebars seems ok). layout.html sets the width of #content to 740px, but it should be 720px to handle the padding in #page. I've tried it on OSX, Chrome+FF5 cheers / jonas

[web2py] changes in 1.96.1 1.96.4

2011-06-23 Thread Jonas Rundberg
local_import has the reload=True feature. How does this work now? 1.96.4 - better support for id fields not called id Are we now able to define any existing integer fields as id? How would I use this? br / jonas

[web2py] Re: CRON doesn't work

2010-11-10 Thread Jonas Rundberg
Hi Sverre, I have the exact same issue. (Running web2py 1.87.3) Did you manage to get to work? / jonas On Nov 4, 11:10 am, Sverre sverreodeg...@gmail.com wrote: My cron tab looking like this #crontab */2 * * * *     root  *sys/test_cron @hourly          root  *applications/mm/cron

[web2py] Re: generic.load

2010-07-16 Thread Jonas Rundberg
Recipes' be updated in the book? (I can help if that's needed, as soon as I understand the concept enough) cheers / jonas On Jul 13, 7:06 pm, mdipierro mdipie...@cs.depaul.edu wrote: BTW since 1.80.1 welcome include a generic.load what is it? Say you have      def someaction():           any

[web2py] w3p_fc bug?

2010-07-16 Thread Jonas Rundberg
Hi In sqlhtml.py, SQLFORM: the comment field's class is w3p_fc. Should't this be w2p_fc to be consistent with w2p_fl and w2p_fw? cheers / jonas

[web2py] Re: Top 3 web2py features

2010-05-25 Thread Jonas Rundberg
Mengu, I agree to all the mentioned pros for web2py. Would you like to elaborate on your first item -scalable? Which features in web2y fo you refer to that facilitates scalability? cheers / jonas On May 7, 12:13 am, Mengu whalb...@gmail.com wrote: 1) scalable 2) fast 3) easy

[web2py] one solution to web2py+eclipse and undefined variable warnings

2010-04-22 Thread Jonas Rundberg
global: (comma separated) There you can add service,auth,T,response,session,request,db or whatever. Doing this seems easier then writing global request, ... at the top of all of your controller files. cheers / jonas rundberg -- Subscription settings: http://groups.google.com/group/web2py