populate form in view

66 visualizações
Pular para a primeira mensagem não lida

Iancic Bogdan

não lida,
25 de ago. de 2015, 08:16:4925/08/2015
para web2py-users
I want to populate a form, besides the input that the user inserts.

This is the code from view:
<script>
        var MattsPublicKeyString = cryptico.publicKeyString(MattsRSAkey);

        print("Matt's public key string:");
        print(MattsPublicKeyString);
</script>
<script type=t"text/javascript">
        document.onload = function(){updateText()};

        function updateText() {
         document.certificate_request_public_key__row.populateme.value =
MattsPublicKeyString;
       }

<h1>{{=T('New Certificate Signing Request')}}</h1>
{{=text}}
<br/>
{{=form}}

The key that I want to insert in the form is correctly displayed but it isint' inserted in the database. What am I doing wrong?

Jim S

não lida,
25 de ago. de 2015, 08:51:2725/08/2015
para web2py-users
Can we see the form definition from your controller?

-Jim

Iancic Bogdan

não lida,
25 de ago. de 2015, 08:52:5325/08/2015
para web2py-users
sure

form = SQLFORM(db.certificate_request).process()
    if form.accepted:
        response.flash = 'new CSR registered'
        redirect(URL('customerArea','index'))

Jim S

não lida,
26 de ago. de 2015, 09:34:3126/08/2015
para web2py-users
I'm confused by the use of .process() at the end of your SQLFORM instantiation.

Instead, I would do this:

form = SQLFORM(db.certificate_request)

if form.process().accepted:
    response.flash = 'new CSR registered'
    redirect(URL('customerArea', 'index')

Hope that helps.

-Jim

Anthony

não lida,
26 de ago. de 2015, 11:07:4326/08/2015
para web2py-users
There's nothing wrong with calling .process() when the form is first defined. Your code is exactly equivalent to the original.

Anthony

Jim Steil

não lida,
26 de ago. de 2015, 11:21:4526/08/2015
para web...@googlegroups.com
Thanks for the correction Anthony, I didn't know that.

-Jim

On Wed, Aug 26, 2015 at 10:07 AM, Anthony <abas...@gmail.com> wrote:
There's nothing wrong with calling .process() when the form is first defined. Your code is exactly equivalent to the original.

Anthony

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/lvimBCvBDl0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem