Re: [web2py] Re: How to call controller function upon onClick from html?

2012-12-03 Thread Arshad Ali
I have problems regarding fetching value from a text field, I have created a form in python/web2py as shown below: form = FORM(DIV (DIV(SPAN(' First Name ', _class='signup', _style=''),INPUT(_name='fname', _style=''' float:right; width:200px; height:20px; border-radius:3px; border:1px soli

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-12-03 Thread Arshad Ali
How can I call a python function from javascript with passing a value getting from text field??? please help me in this. On Monday, September 3, 2012 10:13:20 AM UTC+5, Amit wrote: > > Thanks Anthony :) > > Regards, > Amit > > On Fri, Aug 31, 2012 at 4:47 PM, Anthony >wrote: > >> On Thursday, Au

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-09-02 Thread Amit
Thanks Anthony :) Regards, Amit On Fri, Aug 31, 2012 at 4:47 PM, Anthony wrote: > On Thursday, August 30, 2012 10:44:51 PM UTC-4, Amit wrote: >> >> As I told you I have created my own custom html without extending >> layout.html. > > > "I have created my own custom html" != "I have not loaded j

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-31 Thread Anthony
On Thursday, August 30, 2012 10:44:51 PM UTC-4, Amit wrote: > > As I told you I have created my own custom html without extending > layout.html. "I have created my own custom html" != "I have not loaded jQuery" :-) > I am not sure how to load JQuery in that? > It's just a Javascript libra

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Amit
As I told you I have created my own custom html without extending layout.html. I am not sure how to load JQuery in that? Please check the whole html file in attachement once and suggest me how to support JQuery in the html. Regards, Amit On Thu, Aug 30, 2012 at 4:53 PM, Anthony wrote: > The qu

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Anthony
The query method works fine for me. Are you sure you have jquery loaded? On Thursday, August 30, 2012 7:13:26 AM UTC-4, Amit wrote: > > Hi Anthony, > > I am able to achieve it through Javascript function like below: > > function submitVlaue(thisForm) > { > var recordName = thisForm.nam

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Amit
Hi Anthony, I am able to achieve it through Javascript function like below: function submitVlaue(thisForm) { var recordName = thisForm.name_text_field.value; window.location="{{=URL('default', 'recordr_config') + '/'}}" + recordName ; } but if I use JQuery instead of dir

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Amit
Anthony, I observe one more thing, as I have launched record Info page from other page using below statement: So upon clicking on button , it is launching record_config page , first it will call record_config() function and I am passing record_id to fetch the data about the record and display o

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Amit
Still the same issue :( , its not calling record_config() function... how to check whether JQuery is supported or not? I have created my own custom html page without mentioning {{extend 'layout.html'}} statement, means simple html page withe labels and text fields, so do I need to add some stateme

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Anthony
Replace the single quotes with double quotes inside the jQuery(): onClick='window.location="{{=URL('default', 'record_config') + '/'}}" + jQuery("input[name=name_text_field]").val();' The value will be available as request.args(0) in the record_config() function. Anthon

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-29 Thread Amit
Hi Anthony, I used the code which you have suggested but it's not working at all, it is not calling record_config() function of controller. second point is if the above approach is successful then how would I retrieve the value in controller side: def record_config(): print 'inside rec

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-29 Thread Anthony
> > onclick = 'window.location="{{=URL('default', 'record_config', > args=[name_text_field.value])}}";'> > You cannot refer to name_text_field the way you have. Everything inside {{..}} is Python and must be available on the server before the HTML is rendered and sent to the browser. The inpu

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-28 Thread Amit
Anthony, I am facing one more problem, I have one text Field called Name where user can input the name , i need to pass the entered name to controller function but if I use like: it is flashing error saying "name name_text_field is not defined" , even text field is there in same form ,inside sa

[web2py] Re: How to call controller function upon onClick from html?

2012-08-27 Thread Amit
Thanks Anthony, its working as expected :) regards, Amit On Monday, 27 August 2012 19:21:46 UTC+5:30, Anthony wrote: > > The onclick property of an HTML element must be Javascript. You cannot > call a server-side Python function directly from the browser. If you want > the button to work like a

[web2py] Re: How to call controller function upon onClick from html?

2012-08-27 Thread Anthony
The onclick property of an HTML element must be Javascript. You cannot call a server-side Python function directly from the browser. If you want the button to work like a regular link and simply load a new page in place of the current page, you can do: In that case, you would need Python code