Re: [web2py] Re: Multiple submit not working on component

2010-08-24 Thread Miguel Lopes
Thank you!
Importantly, although it is very convenient to have these values
serialized, it is simple to get around this jQuery imposed limitation (bug).
Miguel

On Tue, Aug 24, 2010 at 4:02 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 well... it is a bug not not in web2py, in jQuery:


 http://www.johnnycode.com/blog/2010/04/08/jquery-form-serialize-doesnt-post-submit-and-button-values-duh/

 We cannot fork jQuery to fix this. Eventually they will fix it.

 Massimo

 On Aug 23, 8:46 am, Miguel Lopes mig.e.lo...@gmail.com wrote:
  As an update, the issue remains with the following combinations:
  * if input type='submit' and different names
  * if input type='button', with or without different name attributes
 
  However, input type='text' are present in form.vars.
 
  For the interested a solution for usage in components is to use set a
 hidden
  input text field via the click event of each button.
  Miguel
 
  On Mon, Aug 23, 2010 at 3:54 AM, Miguel Lopes mig.e.lo...@gmail.com
 wrote:
   I'm using the same name to all input type submits technique. This is
 very
   nice because it avoids some js and works like a charm :-)
   In a regular controller the code works flawlessly. However when I try
 to
   put it in a controller, it fails:
 
   status_form = FORM(_id='status_form')
   for status in OPPTY_STATUS:
   btn = INPUT(_type='submit', _name='status', _value=status,
   _class='status_btn')
   status_form.append(btn)
 
   if status_form.accepts(request.vars, session, formname='status_form'):
   # status_form.vars.status is None in component
   # status_form.vars.status corresponds to whatever submit was
 pressed in
   regular controller
   ...
 
   It seems like the component mechanisms is ignoring the value of
 'status'.
 
   Miguel



[web2py] Re: Multiple submit not working on component

2010-08-24 Thread mdipierro
jquery serialize also does not support type=file. If you have a way to
get around these, please let me know.

On Aug 24, 5:35 am, Miguel Lopes mig.e.lo...@gmail.com wrote:
 Thank you!
 Importantly, although it is very convenient to have these values
 serialized, it is simple to get around this jQuery imposed limitation (bug).
 Miguel

 On Tue, Aug 24, 2010 at 4:02 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  well... it is a bug not not in web2py, in jQuery:

 http://www.johnnycode.com/blog/2010/04/08/jquery-form-serialize-doesn...

  We cannot fork jQuery to fix this. Eventually they will fix it.

  Massimo

  On Aug 23, 8:46 am, Miguel Lopes mig.e.lo...@gmail.com wrote:
   As an update, the issue remains with the following combinations:
   * if input type='submit' and different names
   * if input type='button', with or without different name attributes

   However, input type='text' are present in form.vars.

   For the interested a solution for usage in components is to use set a
  hidden
   input text field via the click event of each button.
   Miguel

   On Mon, Aug 23, 2010 at 3:54 AM, Miguel Lopes mig.e.lo...@gmail.com
  wrote:
I'm using the same name to all input type submits technique. This is
  very
nice because it avoids some js and works like a charm :-)
In a regular controller the code works flawlessly. However when I try
  to
put it in a controller, it fails:

status_form = FORM(_id='status_form')
for status in OPPTY_STATUS:
    btn = INPUT(_type='submit', _name='status', _value=status,
_class='status_btn')
    status_form.append(btn)

if status_form.accepts(request.vars, session, formname='status_form'):
    # status_form.vars.status is None in component
    # status_form.vars.status corresponds to whatever submit was
  pressed in
regular controller
...

It seems like the component mechanisms is ignoring the value of
  'status'.

Miguel


Re: [web2py] Re: Multiple submit not working on component

2010-08-24 Thread Miguel Lopes
On Tue, Aug 24, 2010 at 1:04 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 jquery serialize also does not support type=file. If you have a way to
 get around these, please let me know.


I've researched this a bit. Although I have not found an authoritarive
source, the problem is that Javascript cannot access files on the desktop,
the browser must do it. Thus, not supporting inout type=file is not a jQuery
problem. It is possible to code around this, namely using iframe (any
other?). Someone more knowledgable may confirm this.

Some interesting solutions are (untested):
http://valums.com/ajax-upload/- a dedicated javascript script library
http://trentrichardson.com/2009/06/05/meet-jquery-iframer/- a jQuery
plugin
http://www.webtoolkit.info/ajax-file-upload.html  - a 1Kb Javascript
file

Anyone has experience with these or other solutions?
Miguel


[web2py] Re: Multiple submit not working on component

2010-08-23 Thread Miguel Lopes
As an update, the issue remains with the following combinations:
* if input type='submit' and different names
* if input type='button', with or without different name attributes

However, input type='text' are present in form.vars.

For the interested a solution for usage in components is to use set a hidden
input text field via the click event of each button.
Miguel


On Mon, Aug 23, 2010 at 3:54 AM, Miguel Lopes mig.e.lo...@gmail.com wrote:

 I'm using the same name to all input type submits technique. This is very
 nice because it avoids some js and works like a charm :-)
 In a regular controller the code works flawlessly. However when I try to
 put it in a controller, it fails:

 status_form = FORM(_id='status_form')
 for status in OPPTY_STATUS:
 btn = INPUT(_type='submit', _name='status', _value=status,
 _class='status_btn')
 status_form.append(btn)

 if status_form.accepts(request.vars, session, formname='status_form'):
 # status_form.vars.status is None in component
 # status_form.vars.status corresponds to whatever submit was pressed in
 regular controller
 ...

 It seems like the component mechanisms is ignoring the value of 'status'.

 Miguel



[web2py] Re: Multiple submit not working on component

2010-08-23 Thread mdipierro
I think this is a bug in the web2py in the form processing system. I
will fix it tonight.

On Aug 22, 9:54 pm, Miguel Lopes mig.e.lo...@gmail.com wrote:
 I'm using the same name to all input type submits technique. This is very
 nice because it avoids some js and works like a charm :-)
 In a regular controller the code works flawlessly. However when I try to put
 it in a controller, it fails:

 status_form = FORM(_id='status_form')
 for status in OPPTY_STATUS:
     btn = INPUT(_type='submit', _name='status', _value=status,
 _class='status_btn')
     status_form.append(btn)

 if status_form.accepts(request.vars, session, formname='status_form'):
     # status_form.vars.status is None in component
     # status_form.vars.status corresponds to whatever submit was pressed in
 regular controller
 ...

 It seems like the component mechanisms is ignoring the value of 'status'.

 Miguel


[web2py] Re: Multiple submit not working on component

2010-08-23 Thread mdipierro
well... it is a bug not not in web2py, in jQuery:

http://www.johnnycode.com/blog/2010/04/08/jquery-form-serialize-doesnt-post-submit-and-button-values-duh/

We cannot fork jQuery to fix this. Eventually they will fix it.

Massimo

On Aug 23, 8:46 am, Miguel Lopes mig.e.lo...@gmail.com wrote:
 As an update, the issue remains with the following combinations:
 * if input type='submit' and different names
 * if input type='button', with or without different name attributes

 However, input type='text' are present in form.vars.

 For the interested a solution for usage in components is to use set a hidden
 input text field via the click event of each button.
 Miguel

 On Mon, Aug 23, 2010 at 3:54 AM, Miguel Lopes mig.e.lo...@gmail.com wrote:
  I'm using the same name to all input type submits technique. This is very
  nice because it avoids some js and works like a charm :-)
  In a regular controller the code works flawlessly. However when I try to
  put it in a controller, it fails:

  status_form = FORM(_id='status_form')
  for status in OPPTY_STATUS:
      btn = INPUT(_type='submit', _name='status', _value=status,
  _class='status_btn')
      status_form.append(btn)

  if status_form.accepts(request.vars, session, formname='status_form'):
      # status_form.vars.status is None in component
      # status_form.vars.status corresponds to whatever submit was pressed in
  regular controller
  ...

  It seems like the component mechanisms is ignoring the value of 'status'.

  Miguel