[web2py] Re: lose focus events in form fields

2018-09-27 Thread Donald McClymont
There is some example script here which may help with the idea - both a 
setup for countries and subdivisions with Ajax and also a couple of range 
controls for urgency and importance where I then backfill the values into 
form fields for the actual values.  As far as I am aware web2py does not 
have a range widget so this added another field and then wrote the value 
back.

https://github.com/DonaldMcC/gdms/blob/master/views/answer/answer_question.js

this is loaded by answer_question.html in the same folder

Regards
Donald

On Thursday, September 27, 2018 at 8:25:11 PM UTC+1, Dave S wrote:
>
>
>
> On Thursday, September 27, 2018 at 5:28:50 AM UTC-7, Rahul wrote:
>>
>> Hey All,
>>  This is essential - I can do what Donald has said but I want to 
>> do it at runtime.
>>
>
> Why would you not consider jQuery to be "at runtime"?  He mentioned it in 
> the context of setting the focus events, but it is a much richer toolset 
> than that.  It runs on the client (browser) side, but can send AJAX 
> requests to the server.
>
> It would also be helpful when I try to implement say for example select a 
>> country from drop down and then populate states as per the country selected 
>> in another dropdown. may more use cases like that including calculations 
>> like age by selecting date fro date widget and populating years based on 
>> selected date in another field. I think these use cases are pretty valid 
>> and have seen them in a lot of web apps (typically aspx, php and java/jsp). 
>> How I achieve it in web2py with SQL forms or CRUD forms is what I am 
>> looking for. 
>>
>> Regards,
>> Rahul 
>>
>>
> /dps
>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: lose focus events in form fields

2018-09-27 Thread Dave S


On Thursday, September 27, 2018 at 5:28:50 AM UTC-7, Rahul wrote:
>
> Hey All,
>  This is essential - I can do what Donald has said but I want to 
> do it at runtime.
>

Why would you not consider jQuery to be "at runtime"?  He mentioned it in 
the context of setting the focus events, but it is a much richer toolset 
than that.  It runs on the client (browser) side, but can send AJAX 
requests to the server.

It would also be helpful when I try to implement say for example select a 
> country from drop down and then populate states as per the country selected 
> in another dropdown. may more use cases like that including calculations 
> like age by selecting date fro date widget and populating years based on 
> selected date in another field. I think these use cases are pretty valid 
> and have seen them in a lot of web apps (typically aspx, php and java/jsp). 
> How I achieve it in web2py with SQL forms or CRUD forms is what I am 
> looking for. 
>
> Regards,
> Rahul 
>
>
/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: lose focus events in form fields

2018-09-27 Thread Dave S


On Thursday, September 27, 2018 at 5:28:50 AM UTC-7, Rahul wrote:
>
> Hey All,
>  This is essential - I can do what Donald has said but I want to 
> do it at runtime. It would also be helpful when I try to implement say for 
> example select a country from drop down and then populate states as per the 
> country selected in another dropdown. may more use cases like that 
> including calculations like age by selecting date fro date widget and 
> populating years based on selected date in another field. I think these use 
> cases are pretty valid and have seen them in a lot of web apps (typically 
> aspx, php and java/jsp). How I achieve it in web2py with SQL forms or CRUD 
> forms is what I am looking for. 
>
> Regards,
> Rahul 
>

The basic answer is AJAX, and jQuery provide AJAX tools.  There is also 
support in web2py for some simple direct ajax operations.  

I would urge you not to use the CRUD forms; they are deprecated and not 
being maintained.  In the documentation at the tip of the tree, you will 
find a warning about this.  (There seem to be some hosting issues with 
getting the tip version displayed.)

/dps


> On Thursday, September 27, 2018 at 2:24:04 AM UTC+5:30, Dave S wrote:
>>
>>
>>
>> On Wednesday, September 26, 2018 at 10:43:31 AM UTC-7, Donald McClymont 
>> wrote:
>>>
>>> Hi Rahul
>>>
>>> You could just do this with Jquery as events that run when any of the 3 
>>> fields are exited however I am not convinced that's really a great approach 
>>> - I haven't seen an example of doing this as part of the actual SQLFORM.  
>>> Another question would be do you really need to concatenate them as part of 
>>> your data entry?   If you need them later you could use a 
>>> computed/calculated field or some function to concatenate them when 
>>> required?
>>>
>>> Regards
>>> Donald
>>>
>>>
>> I haven't done the concatenation part [1], but I've done the lost focus 
>> thing as a way to walk through the proper fields of an SQLFORM where which 
>> fields apply depend on the value of the first field.  This has worked 
>> pretty well, except for some oddities ... like deciding to click a sidebar 
>> [or breadcrumb] link instead of finishing the form, or wanting to correct a 
>> single field.
>>
>> /dps
>>  
>>
>>>
>>>
>>> On Tuesday, September 25, 2018 at 1:57:32 PM UTC+1, Rahul wrote:

 Hi Everyone,
   Is it possible to have lost focus events in web2py SQLForms 
 or CRUD ? By lost focus I mean building the Full name automatically from 
 First, Middle and Last Name provided while filling the form and display it 
 in Full name filled upon lost focus of either field.. Can we do it ... how 
 ? 

 Rahul

>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: lose focus events in form fields

2018-09-27 Thread Rahul
Hey All,
 This is essential - I can do what Donald has said but I want to do 
it at runtime. It would also be helpful when I try to implement say for 
example select a country from drop down and then populate states as per the 
country selected in another dropdown. may more use cases like that 
including calculations like age by selecting date fro date widget and 
populating years based on selected date in another field. I think these use 
cases are pretty valid and have seen them in a lot of web apps (typically 
aspx, php and java/jsp). How I achieve it in web2py with SQL forms or CRUD 
forms is what I am looking for. 

Regards,
Rahul 

On Thursday, September 27, 2018 at 2:24:04 AM UTC+5:30, Dave S wrote:
>
>
>
> On Wednesday, September 26, 2018 at 10:43:31 AM UTC-7, Donald McClymont 
> wrote:
>>
>> Hi Rahul
>>
>> You could just do this with Jquery as events that run when any of the 3 
>> fields are exited however I am not convinced that's really a great approach 
>> - I haven't seen an example of doing this as part of the actual SQLFORM.  
>> Another question would be do you really need to concatenate them as part of 
>> your data entry?   If you need them later you could use a 
>> computed/calculated field or some function to concatenate them when 
>> required?
>>
>> Regards
>> Donald
>>
>>
> I haven't done the concatenation part [1], but I've done the lost focus 
> thing as a way to walk through the proper fields of an SQLFORM where which 
> fields apply depend on the value of the first field.  This has worked 
> pretty well, except for some oddities ... like deciding to click a sidebar 
> [or breadcrumb] link instead of finishing the form, or wanting to correct a 
> single field.
>
> /dps
>  
>
>>
>>
>> On Tuesday, September 25, 2018 at 1:57:32 PM UTC+1, Rahul wrote:
>>>
>>> Hi Everyone,
>>>   Is it possible to have lost focus events in web2py SQLForms or 
>>> CRUD ? By lost focus I mean building the Full name automatically from 
>>> First, Middle and Last Name provided while filling the form and display it 
>>> in Full name filled upon lost focus of either field.. Can we do it ... how 
>>> ? 
>>>
>>> Rahul
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: lose focus events in form fields

2018-09-26 Thread Dave S


On Wednesday, September 26, 2018 at 10:43:31 AM UTC-7, Donald McClymont 
wrote:
>
> Hi Rahul
>
> You could just do this with Jquery as events that run when any of the 3 
> fields are exited however I am not convinced that's really a great approach 
> - I haven't seen an example of doing this as part of the actual SQLFORM.  
> Another question would be do you really need to concatenate them as part of 
> your data entry?   If you need them later you could use a 
> computed/calculated field or some function to concatenate them when 
> required?
>
> Regards
> Donald
>
>
I haven't done the concatenation part [1], but I've done the lost focus 
thing as a way to walk through the proper fields of an SQLFORM where which 
fields apply depend on the value of the first field.  This has worked 
pretty well, except for some oddities ... like deciding to click a sidebar 
[or breadcrumb] link instead of finishing the form, or wanting to correct a 
single field.

/dps
 

>
>
> On Tuesday, September 25, 2018 at 1:57:32 PM UTC+1, Rahul wrote:
>>
>> Hi Everyone,
>>   Is it possible to have lost focus events in web2py SQLForms or 
>> CRUD ? By lost focus I mean building the Full name automatically from 
>> First, Middle and Last Name provided while filling the form and display it 
>> in Full name filled upon lost focus of either field.. Can we do it ... how 
>> ? 
>>
>> Rahul
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: lose focus events in form fields

2018-09-26 Thread Donald McClymont
Hi Rahul

You could just do this with Jquery as events that run when any of the 3 
fields are exited however I am not convinced that's really a great approach 
- I haven't seen an example of doing this as part of the actual SQLFORM.  
Another question would be do you really need to concatenate them as part of 
your data entry?   If you need them later you could use a 
computed/calculated field or some function to concatenate them when 
required?

Regards
Donald



On Tuesday, September 25, 2018 at 1:57:32 PM UTC+1, Rahul wrote:
>
> Hi Everyone,
>   Is it possible to have lost focus events in web2py SQLForms or 
> CRUD ? By lost focus I mean building the Full name automatically from 
> First, Middle and Last Name provided while filling the form and display it 
> in Full name filled upon lost focus of either field.. Can we do it ... how 
> ? 
>
> Rahul
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.