I figured out how to fix this. I someone else is trying to modify the view 
for the SQLFORM.grid don't forget to include the grid[1].hidden_fields in 
the form. That's all I needed.

El martes, 10 de diciembre de 2013 20:11:02 UTC-6, Francisco escribió:
>
>
> Hello guys.
>
> I'm doing this:
>
> grid=SQLFORM.grid(db.mytable)
>
> but since I wanted to use a prettier form I created it in the view. It is 
> now complete but it won't let me submit it till I send the _formkey and 
> _formname values, but I can't read them from the grid object.
>
> If I do:
>
> print grid
>
> I get the whole html, but when I try to do grid[1] the hidden div with the 
> formkey is gone. Is this a security measure?. What can I do?
>
> The output is below:
>
> print grid
> <div class="web2py_grid">
>   <div class="form_header row_buttons  ">
>     <a class="button btn" data-w2p_disable_with="default" 
> href="/Recibos/recibos/arrendamiento?_signature=32a8fa14a85227740e30dd933ae4ded83c9db176">
>     <span class="icon leftarrow icon-arrow-left"></span>
>     <span class="buttontext button" title="Regresar">Regresar</span>
>     </a>
>   </div>
>   <form action="#" class="web2py_form" enctype="multipart/form-data" 
> method="post">
>     <table>
>       <tr id="recibos_arrendamiento_id_datos_fiscales__row">
>         <td class="w2p_fl">
>   <label for="recibos_arrendamiento_id_datos_fiscales" 
> id="recibos_arrendamiento_id_datos_fiscales__label">Cliente: </label>
> </td>
> <td class="w2p_fw">
>   <select class="generic-widget" 
> id="recibos_arrendamiento_id_datos_fiscales" name="id_datos_fiscales">
>     <option value=""></option>
>     <option value="2">BAS090307BE7</option>
>   </select>
> </td>
> <td class="w2p_fc">
> </td>
>       </tr>
>       <tr id="recibos_arrendamiento_concepto__row">
>         <td class="w2p_fl">
>   <label for="recibos_arrendamiento_concepto" 
> id="recibos_arrendamiento_concepto__label">Concepto: </label>
> </td>
> <td class="w2p_fw">
>   <input class="string" id="recibos_arrendamiento_concepto" 
> name="concepto" type="text" value="" />
>         </td>
> <td class="w2p_fc"></td>
>       </tr>
>       <tr id="recibos_arrendamiento_monto__row">
>         <td class="w2p_fl">
>   <label for="recibos_arrendamiento_monto" 
> id="recibos_arrendamiento_monto__label">Monto: </label>
> </td>
> <td class="w2p_fw">
>   <input class="decimal" id="recibos_arrendamiento_monto" name="monto" 
> type="text" value="" />
> </td>
> <td class="w2p_fc">
> </td>
>       </tr>
>       <tr id="recibos_arrendamiento_es_local_comercial__row">
>         <td class="w2p_fl">
>   <label for="recibos_arrendamiento_es_local_comercial" 
> id="recibos_arrendamiento_es_local_comercial__label">Es Local Comercial: 
> </label>
> </td>
> <td class="w2p_fw">
>   <input checked="checked" class="boolean" 
> id="recibos_arrendamiento_es_local_comercial" name="es_local_comercial" 
> type="checkbox" value="on" />
> </td>
> <td class="w2p_fc">
> </td>
>       </tr>
>       <tr id="submit_record__row">
>         <td class="w2p_fl">
> </td>
> <td class="w2p_fw">
>   <input type="submit" value="Submit" />
> </td>
> <td class="w2p_fc">
> </td>
>       </tr>
>     </table>
>     <div style="display:none;">
>       <input name="_formkey" type="hidden" 
> value="4026aa7c-183f-4478-b2f3-a035c20566d9" />
>       <input name="_formname" type="hidden" value="web2py_grid" />
>     </div>
>   </form>
>   <div class="form_footer row_buttons  "></div>
> </div>
>
> This should include the hidden div since it's inside the form, but it 
> doesn't
> print grid[1]
>
>     <table>
>       <tr id="recibos_arrendamiento_id_datos_fiscales__row">
>         <td class="w2p_fl">
>   <label for="recibos_arrendamiento_id_datos_fiscales" 
> id="recibos_arrendamiento_id_datos_fiscales__label">Cliente: </label>
> </td>
> <td class="w2p_fw">
>   <select class="generic-widget" 
> id="recibos_arrendamiento_id_datos_fiscales" name="id_datos_fiscales">
>     <option value=""></option>
>     <option value="2">BAS090307BE7</option>
>   </select>
> </td>
> <td class="w2p_fc">
> </td>
>       </tr>
>       <tr id="recibos_arrendamiento_concepto__row">
>         <td class="w2p_fl">
>   <label for="recibos_arrendamiento_concepto" 
> id="recibos_arrendamiento_concepto__label">Concepto: </label>
> </td>
> <td class="w2p_fw">
>   <input class="string" id="recibos_arrendamiento_concepto" 
> name="concepto" type="text" value="" />
>         </td>
> <td class="w2p_fc"></td>
>       </tr>
>       <tr id="recibos_arrendamiento_monto__row">
>         <td class="w2p_fl">
>   <label for="recibos_arrendamiento_monto" 
> id="recibos_arrendamiento_monto__label">Monto: </label>
> </td>
> <td class="w2p_fw">
>   <input class="decimal" id="recibos_arrendamiento_monto" name="monto" 
> type="text" value="" />
> </td>
> <td class="w2p_fc">
> </td>
>       </tr>
>       <tr id="recibos_arrendamiento_es_local_comercial__row">
>         <td class="w2p_fl">
>   <label for="recibos_arrendamiento_es_local_comercial" 
> id="recibos_arrendamiento_es_local_comercial__label">Es Local Comercial: 
> </label>
> </td>
> <td class="w2p_fw">
>   <input checked="checked" class="boolean" 
> id="recibos_arrendamiento_es_local_comercial" name="es_local_comercial" 
> type="checkbox" value="on" />
> </td>
> <td class="w2p_fc">
> </td>
>       </tr>
>       <tr id="submit_record__row">
>         <td class="w2p_fl">
> </td>
> <td class="w2p_fw">
>   <input type="submit" value="Submit" />
> </td>
> <td class="w2p_fc">
> </td>
>       </tr>
>     </table>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to