Can you send a minimal app that replicates the behavior?

On Monday, August 15, 2011 11:52:45 PM UTC-4, weheh wrote:

> Firebug shows only 1 outgoing request to each of the .load actions on 
> the page, including the offending one. 
>
> I've checked for broken links and there are none. 
>
> I'm checking but I'm 99.999% confident there is no js adding to the 
> DOM with respect to this form. 
>
> If it helps, you can see the problem at http://beta.yakitome.com and 
> click on the Upload tab and then the "From Text" accordion. Click the 
> TTS button and nothing happens the first time. After that, it works 
> ok. 
>
> On Aug 15, 12:43 pm, Anthony <[email protected]> wrote: 
> > Could it be in the containing page, or maybe some javascript that is 
> adding 
> > to the DOM dynamically? Check the browser developer tools for outgoing 
> > requests. 
> > 
> > Anthony 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Monday, August 15, 2011 10:56:19 AM UTC-4, weheh wrote: 
> > > The view for the LOAD in question is here: 
> > 
> > > {{=DIV( 
> > >     form.custom.begin, 
> > >     FIELDSET( 
> > >         form.custom.widget.text_field, 
> > >         _class='some-class', 
> > >         ), 
> > >     my_button(), 
> > >     form.custom.end, 
> > >     ) 
> > > }} 
> > 
> > > and my_button is defined: 
> > 
> > > my_button(): 
> > >     return DIV( 
> > >         INPUT( 
> > >             _type='submit', 
> > >             _value=T('do it'), 
> > >             _title=T('do it'), 
> > >             _alt=T('do it'), 
> > >             _class='button', 
> > >             ), 
> > >         _class='some-other-class', 
> > >         ) 
> > 
> > > So it seems there are no images being downloaded here. 
> > 
> > > On Aug 15, 3:57 am, Massimo Di Pierro <[email protected]> 
> > > wrote: 
> > > > If your view contains something like 
> > 
> > > > <img src="" /> 
> > 
> > > > you would get a second call to the URL itself. 
> > 
> > > > On Aug 15, 2:44 am, weheh <[email protected]> wrote: 
> > 
> > > > > Just as you predicted, kimosabe, there is a second pass through the 
>
> > > > > action. I made an var in my model and assigned the env.path_info to 
>
> > > > > it. Here's what I see in Eclipse: 
> > 
> > > > > ... 
> > > > > ENV_PATH_INFO   str: /YAKiToMe/my_controller/my_action.load 
> > > > > ENV_PATH_INFO (126270224)       str: 
> > > /YAKiToMe/my_controller/my_action.load 
> > > > > ... 
> > > > > I'm not sure where the 2nd pass is coming from. Also, I don't know 
> > > > > what to make of the number in parenthesis ... Eclipse is trying to 
> > > > > tell me something ... do you know what it is? 
> > 
> > > > > On Aug 15, 3:03 am, weheh <[email protected]> wrote: 
> > 
> > > > > > Very interesting. Yes, it makes sense now that I see for 1st time 
>
> > > that 
> > > > > > models are being called for each & every LOAD. Now it is obvious 
> why 
> > > > > > browser refresh is slow for me! I am tracing it through and will 
> let 
> > > > > > you know what I find. Thanks for the lead. 
> > 
> > > > > > On Aug 14, 6:04 pm, Massimo Di Pierro <[email protected]> 
> > > > > > wrote: 
> > 
> > > > > > > in your models add a 
> > 
> > > > > > > print request.env.path_info 
> > 
> > > > > > > you may find somehow you have one more call than you think 
> which 
> > > > > > > resets the session. This may be due to a broken link in the 
> view. 
> > 
> > > > > > > On 14 Ago, 14:01, weheh <[email protected]> wrote: 
> > 
> > > > > > > > As you can see, nothing really fancy here. 
> > 
> > > > > > > > def my_action(): 
> > > > > > > >     form=SQLFORM.factory( 
> > > > > > > >             Field('text_field','text', 
> > > > > > > >                 length=100000 if auth.user_id else 50, 
> > > > > > > >                 default=T("default text") if not auth.user_id 
>
> > > else '', 
> > > > > > > >                 requires=IS_NOT_EMPTY()), 
> > > > > > > >                 _id='text-form') 
> > 
> > > > > > > >     if form.accepts(request.vars,session): 
> > > > > > > >         # the body of this won't be executed the first time 
> the 
> > > form 
> > > > > > > >         # is loaded, but it does get executed every time 
> > > thereafter 
> > > > > > > >         # so this is not where the problem is 
> > > > > > > >     elif form.errors: 
> > > > > > > >         # this condition is tested the first time the form is 
>
> > > > > > > >         # submitted, but not thereafter because the form 
> > > > > > > >         # accepts properly the second and subsequent times 
> > 
> > > > > > > >     return dict(form=form) 
> > 
> > > > > > > > The view is down below some widgets and stuff. It always 
> displays 
> > 
> > > > > > > > properly. 
> > > > > > > > Here's the actual LOAD statement: 
> > 
> > > <div>{{=LOAD('my_controller','my_action.load',ajax=True)}}</div> 
> > 
> > > > > > > > On Aug 14, 2:36 pm, Anthony <[email protected]> wrote: 
> > 
> > > > > > > > > Can you show your controller and view code? 
> > 
> > > > > > > > > On Sunday, August 14, 2011 2:14:19 PM UTC-4, weheh wrote: 
> > > > > > > > > > I have a componentized form that is behaving very 
> strangely. 
> > > The form 
> > > > > > > > > > is very simple -- just a text field. 
> > 
> > > > > > > > > >   form=SQLFORM.factory(Field('text_in','text')) 
> > 
> > > > > > > > > >   if form.accepts(request.vars, session): 
> > > > > > > > > >    .... do stuff ... 
> > 
> > > > > > > > > > The first time I load the form, it loads fine. I traced 
> it in 
> > > Eclipse 
> > > > > > > > > > and saw the form getting created with SQLFORM.factory. 
> When I 
> > > fill in 
> > > > > > > > > > text, however, the form does not accept, nor does it 
> generate 
> > > any 
> > > > > > > > > > error. Inspecting in Eclipse shows form.vars is empty. 
> > 
> > > > > > > > > > OK, so now the form is still visible since it was 
> reloaded. I 
> > > enter 
> > > > > > > > > > the same text again and click submit. This time, the 
> > > form.accepts(...) 
> > > > > > > > > > accepts the form and processes it. 
> > 
> > > > > > > > > > I upgraded to the latest and greatest version but still 
> get 
> > > this 
> > > > > > > > > > strange behavior. Anybody have an idea what's going on?

Reply via email to