I ended up updating the database fields in the callback function in web2py 
controller, then return a True to indicate ajax to do a location.reload() 
to render the page. it does what I need. Apologize for all these questions 
and answers myself, but I thought i would share with someone who may need 
it later. Thanks and case close.

On Wednesday, June 7, 2017 at 1:15:15 PM UTC+8, Rudy wrote:
>
> I just used the firefox inspector to see the source and spot the id and 
> tag I need to get the non-writable field value, something like below:
> var quote_id =  jQuery('#quotation_id__row').children("p")[0].innerHTML;
>
> Apologize for any bother, I am still learning a lot of stuffs eg. web2py, 
> javascript, even python. Often times I see other experience coders here to 
> leverage the API http://web2py.readthedocs.io/en/latest/index.html. For 
> this particular question, i thought I could find something from web2py to 
> toggle, so that i could read the value of an non-writable field, i went to 
> this above API link and did a search for FORM writable, but i didn't see 
> where it's building the HTML from web2py engine. Any basic guideline or 
> instruction how i can leverage this APIs. Sorry if it sounds dumb.
>
> Now I can read the non-writable field from a FORM, I want javascript to 
> make a callback and return a json to update a few fields (non-writable) 
> fields in the FORM. Wonder what's the best way to do it, since they are 
> non-writable I can see from the firefox inspector that non-writable and 
> writable fields are structured like below with HTML elements. BTW, i could 
> retrieve the right data from jason and print them out using alert, but I 
> couldn't update the non-writable fields. Do I need to alter the HTML 
> elements for those non-writable fields to writable HTML element structure, 
> and reverse them back right after I update them? Any suggestion is 
> appreciated.
>
>
>
> <https://lh3.googleusercontent.com/-eusFTb0OJlU/WTeIv6CjtrI/AAAAAAAAAyg/ACVL2hJG78UamFeUiATDSWTfq4g2K0DXACLcB/s1600/non-writable.png>
>  
> <https://lh3.googleusercontent.com/-Wu9qWqnPkYo/WTeJDf-8lAI/AAAAAAAAAyk/sywnenXTOVcQJk_bjdNQeUunYLG9K6yJgCLcB/s1600/writable.png>
>
>
>
>
>
>
>
>
> On Wednesday, June 7, 2017 at 7:49:39 AM UTC+8, Rudy wrote:
>>
>> I posted a question a couple days ago asking how I can read a SQLFORM's 
>> field and update it using javascript when its writable=False (because user 
>> is not supposed to make change to the subtotal field manually, it should be 
>> calculated based on the sum of all the items), but I didn't get any reply. 
>> Now I wonder if anyone can share your insight how i can read a SQLFORM 
>> field which writable=False, thanks in advance!
>>
>

-- 
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.

Reply via email to