Yes, that works: use request.vars.*. That was the option which I had mentioned I may need to resort to, since *keepvalues *doesn't seem to work for me. This basically comes down to me creating a bunch of widgets; mirroring the ones in web2py, where a widget would have logic, similar to the one below, in it. I need to figure out how to create a widget now. Am familiar with creating jsp tag libraries, and dojo widgets.

|
 <input type="text" class="form-control
                   {{if form.errors.country:}}invalidinput{{pass}}"
                    id="country" name="country"
value="{{=request.vars.country or form.custom.inpval['country']}}"
                    placeholder=|"{{=form.custom.comment['country']}}"
|
|

Thanks for your inputs,
Kiran

________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On 1/14/2014 1:23 AM, Massimo Di Pierro wrote:
Strange. How about

{{=request.vars.country or form.custom.inpval['country']}}

On Monday, 13 January 2014 11:13:33 UTC-6, subbaram...@gmail.com wrote:

    Massimo,
    Yes, I did. Does not make a difference.

    Thanks for the suggestion,
    Kiran

    On Monday, January 13, 2014 7:49:15 PM UTC+5:30, Massimo Di Pierro
    wrote:

        Have you tried replacing

        value="{{=form.custom.inpval['country']}}"

        with

        value="{{=form.custom.dspval['country']}}"

        On Sunday, 12 January 2014 22:50:43 UTC-6,
        subbaram...@gmail.com wrote:

            Really would like some help with this. Anyone have
            suggestions?
            Thank you,
            Kiran

            On Saturday, January 11, 2014 12:10:07 AM UTC+5:30,
            subbaram...@gmail.com wrote:

                Hello All,
                The *design *is: I have a custom form with the a
                controller that inserts/updates a table. Tthe form
                accepts data, and on successful submission of this
                form, it stays on the same page (there are no
                redirects to another page or form)
                *Issue*: The problem am seeing is, when I update
                values in the form, and submit it, the entered values
                are lost when the form returns because of successful
                submit, or due to errors. I have tried to use
                keepvalues=True in the form.accepts() and
                form.process() methods. No luck.
                Details below.

                Since the page am building has specific design needs,
                I went with the option of a custom form, where I used
                the form.custom.* options quite a bit. Therefore input
                fields in the form look like this
                |
                 <input type="text" class="form-control
                                   {{if
                form.errors.country:}}invalidinput{{pass}}"
                                    id="country" name="country"
                value="{{=form.custom.inpval['country']}}"
placeholder=|"{{=form.custom.comment['country']}}"
                |
                |

                Also the controller is coded as below
                |
                    x =db(db.x.x_id ==auth.user.id).select().first()
                ifx:
                        form =SQLFORM(db.x,record=x)
                else:
                form =SQLFORM(db.x)
                pass


                # process the form
                
ifform.accepts(request.vars,formname='basicinfo_form',keepvalues=True):
                        response.flash ='Basic Information updated
                successfully.'
                elifform.errors:
                        response.flash ='The submitted form contains
                errors. The fields in error are highlighted below.'
                else:
                        response.flash ='Please fill the form.'
                pass

                returndict(form=form)
                |

                I was thinking that maybe I should capture the
                request.vars and send it back to the view alongwith
                the form.
                If the request.vars.country value exists, then I use
                that, instead of the form.custom.inpval['country'].
                This only makes the view code a bit more verbose, but
                if it solves the problem, then nothing like it.

                Can anyone suggest what I could do to sort this out?
                Thank you,
                Kiran

                P.S: I did take a look at all the conversations in the
                forum about keepvalues. None of them seemed to help
                me. Though I did find this one to be interesting and
                am curious if this is sorted out already:
                
https://groups.google.com/forum/#!searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ
                
<https://groups.google.com/forum/#%21searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ>

--
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/groups/opt_out.

--
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/groups/opt_out.

Reply via email to