[web2py] Re: Convert forms to html helpers

2015-07-13 Thread 黄祥
i think your approached is the most efficient way.
please read this discussion :
http://stackoverflow.com/questions/8091487/what-are-the-benefits-of-building-html-markup-with-html-helpers-in-web2py

best regards,
stifan

-- 
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: Convert forms to html helpers

2015-07-13 Thread Anthony
I don't think I've seen any such tools. In general, it is not very common 
to create large static sections of the DOM using the web2py HTML helpers. 
They are more useful when you need to generate DOM programmatically (e.g., 
input some form configuration parameters and automatically produce a form 
DOM, such as how SQLFORM works) -- in that case, though, you would be 
writing a function to generate the DOM, not merely parsing some existing 
HTML and converting it to web2py helper code.

What exactly are you trying to achieve? Why do you want to convert that 
HTML markup to web2py helper code?

Note, if you just want to parse some existing HTML into a helper *object *that 
can then be manipulated (rather than producing actual helper *code*), you 
can use the parsing functionality of the TAG helper as described here: 
http://web2py.com/books/default/chapter/29/05/the-views#Parsing

Anthony

On Monday, July 13, 2015 at 9:20:48 AM UTC-4, LoveWeb2py wrote:

 Hi Stifan,

 Thank you for replying. Do you know if there is anything that converts 
 forms automatically? I'd think there would be something to do this by now?

 On Monday, July 13, 2015 at 7:46:32 AM UTC-4, LoveWeb2py wrote:

 Hello,

 Is there something within web2py that automatically converts html forms 
 to html HELPER SYNTAX?

 for example here is my form:
 div id=checkout-area style=display: none;
 h4i class=icon-shopping-cart/i Secure Checkout/h4
 script type=text/javascript src=https://js.stripe.com/v2/
 /script
 div id=checkout-form style=display: none;
  form id=CardForm
  div class=control-group
  labelCardholder Name/label
  input id=CardName
 span class=help-inline/span
 /div
 
 div class=control-group
  labelAddress/label
  input id=address
 span class=help-inline/span
 /div
 
 div class=control-group
  labelCity/label
  input id=city
 span class=help-inline/span
 /div
 
 div class=control-group
  labelState/label
  input id=state
 span class=help-inline/span
 /div
 
 div class=control-group
  labelZip Code/label
  input id=zip
 span class=help-inline/span
 /div
 
 div id=div-card class=control-group
  labelCard Number/label
  input id=CardNumber placeholder=4242424242424242/
  span id=span-card class=help-inline/span
 /div
 
 div id=div-exp class=control-group
  labelExpiration/label
 input id=CardExpiration placeholder=12/2013/
 span id=span-exp class=help-inline/span
 /div
 
 div id=div-cvc class=control-group
  labelCVC Code/label
  input id=CardCVC placeholder=123/
 span id=span-cvc class=help-inline/span
 /div
 
  div class=form-actions
  button type=submit class=btn 
 btn-primarySubmit/button
 /div
 /form
 /div

 and I want to convert it something like this: 
 DIV(H4(I(_class='icon-shopping-cart')), _id=checkout_area, 
 _style=display: none;
 )

 What is the most efficient way to do this? 



-- 
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: Convert forms to html helpers

2015-07-13 Thread 黄祥


 Do you know if there is anything that converts forms automatically?


had you already read the book? web2py provides many way to create a form 
(FORM, SQLFORM, crud, SQLFORM.grid, SQLFORM.factory, form custom) to 
convert form automatically, i don't think it have. 

i think the closer method to catch up with your code is using form.custom, 
please take a look at the book.
ref:
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms

best regards,
stifan

-- 
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: Convert forms to html helpers

2015-07-13 Thread LoveWeb2py
Parsing!! Not sure how I missed that. Thank you, Anthony. This is exactly 
what I was looking for.

On Monday, July 13, 2015 at 9:41:09 AM UTC-4, Anthony wrote:

 I don't think I've seen any such tools. In general, it is not very common 
 to create large static sections of the DOM using the web2py HTML helpers. 
 They are more useful when you need to generate DOM programmatically (e.g., 
 input some form configuration parameters and automatically produce a form 
 DOM, such as how SQLFORM works) -- in that case, though, you would be 
 writing a function to generate the DOM, not merely parsing some existing 
 HTML and converting it to web2py helper code.

 What exactly are you trying to achieve? Why do you want to convert that 
 HTML markup to web2py helper code?

 Note, if you just want to parse some existing HTML into a helper *object 
 *that 
 can then be manipulated (rather than producing actual helper *code*), you 
 can use the parsing functionality of the TAG helper as described here: 
 http://web2py.com/books/default/chapter/29/05/the-views#Parsing

 Anthony

 On Monday, July 13, 2015 at 9:20:48 AM UTC-4, LoveWeb2py wrote:

 Hi Stifan,

 Thank you for replying. Do you know if there is anything that converts 
 forms automatically? I'd think there would be something to do this by now?

 On Monday, July 13, 2015 at 7:46:32 AM UTC-4, LoveWeb2py wrote:

 Hello,

 Is there something within web2py that automatically converts html forms 
 to html HELPER SYNTAX?

 for example here is my form:
 div id=checkout-area style=display: none;
 h4i class=icon-shopping-cart/i Secure Checkout/h4
 script type=text/javascript src=https://js.stripe.com/v2/
 /script
 div id=checkout-form style=display: none;
  form id=CardForm
  div class=control-group
  labelCardholder Name/label
  input id=CardName
 span class=help-inline/span
 /div
 
 div class=control-group
  labelAddress/label
  input id=address
 span class=help-inline/span
 /div
 
 div class=control-group
  labelCity/label
  input id=city
 span class=help-inline/span
 /div
 
 div class=control-group
  labelState/label
  input id=state
 span class=help-inline/span
 /div
 
 div class=control-group
  labelZip Code/label
  input id=zip
 span class=help-inline/span
 /div
 
 div id=div-card class=control-group
  labelCard Number/label
  input id=CardNumber placeholder=4242424242424242/
  span id=span-card class=help-inline/span
 /div
 
 div id=div-exp class=control-group
  labelExpiration/label
 input id=CardExpiration placeholder=12/2013/
 span id=span-exp class=help-inline/span
 /div
 
 div id=div-cvc class=control-group
  labelCVC Code/label
  input id=CardCVC placeholder=123/
 span id=span-cvc class=help-inline/span
 /div
 
  div class=form-actions
  button type=submit class=btn 
 btn-primarySubmit/button
 /div
 /form
 /div

 and I want to convert it something like this: 
 DIV(H4(I(_class='icon-shopping-cart')), _id=checkout_area, 
 _style=display: none;
 )

 What is the most efficient way to do this? 



-- 
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: Convert forms to html helpers

2015-07-13 Thread LoveWeb2py
Hi Stifan,

Thank you for replying. Do you know if there is anything that converts 
forms automatically? I'd think there would be something to do this by now?

On Monday, July 13, 2015 at 7:46:32 AM UTC-4, LoveWeb2py wrote:

 Hello,

 Is there something within web2py that automatically converts html forms to 
 html HELPER SYNTAX?

 for example here is my form:
 div id=checkout-area style=display: none;
 h4i class=icon-shopping-cart/i Secure Checkout/h4
 script type=text/javascript src=https://js.stripe.com/v2/
 /script
 div id=checkout-form style=display: none;
  form id=CardForm
  div class=control-group
  labelCardholder Name/label
  input id=CardName
 span class=help-inline/span
 /div
 
 div class=control-group
  labelAddress/label
  input id=address
 span class=help-inline/span
 /div
 
 div class=control-group
  labelCity/label
  input id=city
 span class=help-inline/span
 /div
 
 div class=control-group
  labelState/label
  input id=state
 span class=help-inline/span
 /div
 
 div class=control-group
  labelZip Code/label
  input id=zip
 span class=help-inline/span
 /div
 
 div id=div-card class=control-group
  labelCard Number/label
  input id=CardNumber placeholder=4242424242424242/
  span id=span-card class=help-inline/span
 /div
 
 div id=div-exp class=control-group
  labelExpiration/label
 input id=CardExpiration placeholder=12/2013/
 span id=span-exp class=help-inline/span
 /div
 
 div id=div-cvc class=control-group
  labelCVC Code/label
  input id=CardCVC placeholder=123/
 span id=span-cvc class=help-inline/span
 /div
 
  div class=form-actions
  button type=submit class=btn btn-primarySubmit/button
 /div
 /form
 /div

 and I want to convert it something like this: 
 DIV(H4(I(_class='icon-shopping-cart')), _id=checkout_area, 
 _style=display: none;
 )

 What is the most efficient way to do this? 


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