You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Yinghai Zhao <zy...@gmail.com> on 2011/02/09 22:46:04 UTC

Page did not get form data from ajax call

Hi all.

I'm following the simple ajax form example. everthing is pretty much the
same except that i have a field set with two textbox, one dropdown list.
In the onAction method, I'm trying to get the value from the field by using
field.getValue() and then update the html page.

it seems the string i got from the fields are null. I debugged my
javascripts, it looks like the serialized formData contains the correct
value, but in the page class, the value is null.
I though it was the fieldset causing the problem, so i added a line to
register the fieldSet :
 ControlRegistry.registerAjaxTarget(fieldSet);
but this didn't help.

Also another thing different from the example is that the page I'm working
on is a superclass of two pages.
The ajax call is from one of the sub class. not sure if this is relevant.

Thanks in advance for any suggestions on troubleshooting this issue.

Yinghai

Re: Page did not get form data from ajax call

Posted by Bob Schellink <sa...@gmail.com>.
Hi,

Looks like you are sending the ID of the submit button, not the ID of the form. Essentially you are
telling Click the target  ajax control is the submit button, not the form. Thus Click processes only
the button not the form or it's fields.

To fix, use JavaScript to pass in the Form id, not the button id.

Kind regards

Bob

Re: Page did not get form data from ajax call

Posted by Yinghai Zhao <zy...@gmail.com>.
My current work around is to use getContext() to get a handle on the request
param, and then get value from there.
this way seems working fine. just not able to get value directly from the
form field itself.

Yinghai

On Thu, Feb 10, 2011 at 10:30 AM, Yinghai Zhao <zy...@gmail.com> wrote:

> Thank you Bob for the reply.
>
> I see no problem in trace log:
>
> [Click] [debug] POST
> http://ci0000000944011.rim.net:8080/ExternalIssueMap/externalissue/AddEI.htm
> [Click] [trace]    is Ajax request: true
> [Click] [trace]    request param: Save=Save
> [Click] [trace]    request param: eiform_Save=1
> [Click] [trace]    request param: externalSystemId=123
> [Click] [trace]    request param: externalSystemName=MKS
> [Click] [trace]    request param: externalSystemState=
> [Click] [trace]    request param: form_name=eiform
> [Click] [trace]    invoked: AddEI.<<init>>
> [Click] [trace]    invoked: AddEI.onSecurityCheck() : true
> [Click] [trace]    invoked: AddEI.onInit()
> [Click] [trace]    invoked: 'rootMenu' Menu.onInit()
> [Click] [trace]    invoked: 'eiform' EIFormPage$1.onInit()
> [Click] [trace]    the following controls have been registered as potential
> Ajax targets:
> [Click] [trace]       EIFormPage.1: name='eiform'
> [Click] [trace]       Submit: name='Save'
> [Click] [trace]    invoked: 'Save' Submit.isAjaxTarget() : true (Ajax
> target control found)
> [Click] [trace]    invoked: 'Save' Submit.onProcess() : true
> [Click] [trace]    processing AjaxBehaviors for control: 'Save' Submit
> [Click] [trace]       invoked: AddEI.1.isAjaxTarget() : true
> [Click] [trace]       invoked: AddEI.1.onAction() : ActionResult
> (ActionResult will be rendered)
> [Click] [info ]    renderActionResult (text/html) - 0 ms
> [Click] [trace]    invoked: 'rootMenu' Menu.onDestroy()
> [Click] [trace]    invoked: 'eiform' EIFormPage$1.onDestroy()
> [Click] [trace]    invoked: AddEI.onDestroy()
> [Click] [info ] handleRequest:  /externalissue/AddEI.htm - 0 ms
>
> in the parameter section of Net panel in firebug, it seems sending all the
> values:
>
> Parametersapplication/x-www-form-urlencoded
> Save Saveeiform_Save1 externalSystemId123 externalSystemNameMKS
> externalSystemState form_nameeiform
> Source
>
> form_name=eiform&externalSystemId=123&externalSystemState=&externalSystemName=MKS&eiform_Save=1&Save
> =Save
>
>
>
>
> On Wed, Feb 9, 2011 at 6:15 PM, Bob Schellink <sa...@gmail.com> wrote:
>
>> Hi,
>>
>> If your onAction method is called, it's a good start. Next check in
>> Firebug Net panel if the field
>> value is being sent to the server. You only need to register the Form as
>> an Ajax target. Also look
>> at the logs in trace mode for anything suspicious.
>>
>> If all else fails can you post your code here which reproduce the problem?
>>
>> Kind regards
>>
>> Bob
>>
>>
>> On 2011/02/10 08:46 AM, Yinghai Zhao wrote:
>> > Hi all.
>> >
>> > I'm following the simple ajax form example. everthing is pretty much the
>> same except that i have a
>> > field set with two textbox, one dropdown list.
>> > In the onAction method, I'm trying to get the value from the field by
>> using field.getValue() and
>> > then update the html page.
>> >
>> > it seems the string i got from the fields are null. I debugged my
>> javascripts, it looks like the
>> > serialized formData contains the correct value, but in the page class,
>> the value is null.
>> > I though it was the fieldset causing the problem, so i added a line to
>> register the fieldSet :
>> >    ControlRegistry.registerAjaxTarget(fieldSet);
>> > but this didn't help.
>> >
>> > Also another thing different from the example is that the page I'm
>> working on is a superclass of two
>> > pages.
>> > The ajax call is from one of the sub class. not sure if this is
>> relevant.
>> >
>> > Thanks in advance for any suggestions on troubleshooting this issue.
>> >
>> > Yinghai
>> >
>> >
>>
>>
>

Re: Page did not get form data from ajax call

Posted by Yinghai Zhao <zy...@gmail.com>.
Thank you Bob for the reply.

I see no problem in trace log:

[Click] [debug] POST
http://ci0000000944011.rim.net:8080/ExternalIssueMap/externalissue/AddEI.htm
[Click] [trace]    is Ajax request: true
[Click] [trace]    request param: Save=Save
[Click] [trace]    request param: eiform_Save=1
[Click] [trace]    request param: externalSystemId=123
[Click] [trace]    request param: externalSystemName=MKS
[Click] [trace]    request param: externalSystemState=
[Click] [trace]    request param: form_name=eiform
[Click] [trace]    invoked: AddEI.<<init>>
[Click] [trace]    invoked: AddEI.onSecurityCheck() : true
[Click] [trace]    invoked: AddEI.onInit()
[Click] [trace]    invoked: 'rootMenu' Menu.onInit()
[Click] [trace]    invoked: 'eiform' EIFormPage$1.onInit()
[Click] [trace]    the following controls have been registered as potential
Ajax targets:
[Click] [trace]       EIFormPage.1: name='eiform'
[Click] [trace]       Submit: name='Save'
[Click] [trace]    invoked: 'Save' Submit.isAjaxTarget() : true (Ajax target
control found)
[Click] [trace]    invoked: 'Save' Submit.onProcess() : true
[Click] [trace]    processing AjaxBehaviors for control: 'Save' Submit
[Click] [trace]       invoked: AddEI.1.isAjaxTarget() : true
[Click] [trace]       invoked: AddEI.1.onAction() : ActionResult
(ActionResult will be rendered)
[Click] [info ]    renderActionResult (text/html) - 0 ms
[Click] [trace]    invoked: 'rootMenu' Menu.onDestroy()
[Click] [trace]    invoked: 'eiform' EIFormPage$1.onDestroy()
[Click] [trace]    invoked: AddEI.onDestroy()
[Click] [info ] handleRequest:  /externalissue/AddEI.htm - 0 ms

in the parameter section of Net panel in firebug, it seems sending all the
values:

Parametersapplication/x-www-form-urlencoded
SaveSaveeiform_Save1externalSystemId123externalSystemNameMKS
externalSystemStateform_nameeiform
Source
form_name=eiform&externalSystemId=123&externalSystemState=&externalSystemName=MKS&eiform_Save=1&Save
=Save




On Wed, Feb 9, 2011 at 6:15 PM, Bob Schellink <sa...@gmail.com> wrote:

> Hi,
>
> If your onAction method is called, it's a good start. Next check in Firebug
> Net panel if the field
> value is being sent to the server. You only need to register the Form as an
> Ajax target. Also look
> at the logs in trace mode for anything suspicious.
>
> If all else fails can you post your code here which reproduce the problem?
>
> Kind regards
>
> Bob
>
>
> On 2011/02/10 08:46 AM, Yinghai Zhao wrote:
> > Hi all.
> >
> > I'm following the simple ajax form example. everthing is pretty much the
> same except that i have a
> > field set with two textbox, one dropdown list.
> > In the onAction method, I'm trying to get the value from the field by
> using field.getValue() and
> > then update the html page.
> >
> > it seems the string i got from the fields are null. I debugged my
> javascripts, it looks like the
> > serialized formData contains the correct value, but in the page class,
> the value is null.
> > I though it was the fieldset causing the problem, so i added a line to
> register the fieldSet :
> >    ControlRegistry.registerAjaxTarget(fieldSet);
> > but this didn't help.
> >
> > Also another thing different from the example is that the page I'm
> working on is a superclass of two
> > pages.
> > The ajax call is from one of the sub class. not sure if this is relevant.
> >
> > Thanks in advance for any suggestions on troubleshooting this issue.
> >
> > Yinghai
> >
> >
>
>

Re: Page did not get form data from ajax call

Posted by Bob Schellink <sa...@gmail.com>.
Hi,

If your onAction method is called, it's a good start. Next check in Firebug Net panel if the field
value is being sent to the server. You only need to register the Form as an Ajax target. Also look
at the logs in trace mode for anything suspicious.

If all else fails can you post your code here which reproduce the problem?

Kind regards

Bob


On 2011/02/10 08:46 AM, Yinghai Zhao wrote:
> Hi all.
> 
> I'm following the simple ajax form example. everthing is pretty much the same except that i have a
> field set with two textbox, one dropdown list.
> In the onAction method, I'm trying to get the value from the field by using field.getValue() and
> then update the html page.
> 
> it seems the string i got from the fields are null. I debugged my javascripts, it looks like the
> serialized formData contains the correct value, but in the page class, the value is null.
> I though it was the fieldset causing the problem, so i added a line to register the fieldSet :     
>    ControlRegistry.registerAjaxTarget(fieldSet);
> but this didn't help.
> 
> Also another thing different from the example is that the page I'm working on is a superclass of two
> pages.
> The ajax call is from one of the sub class. not sure if this is relevant.
> 
> Thanks in advance for any suggestions on troubleshooting this issue.
> 
> Yinghai
> 
>