You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Harring Figueiredo <ha...@gmail.com> on 2007/04/25 00:48:35 UTC

[s2]theme="ajax" for form/submit button

Folks,

I have a form with a submit button as follows

<s:form action="member_login.action" theme="ajax" validate="true">
    <s:textfield key="username" />
    <s:password key="password" showPassword="false"/>
    <s:submit key="button.save" theme="ajax" targets="RightPaneWindow" />
    <s:reset key="button.reset"/>
</s:form>

On the page itself, I have an IFrame with the div="RightPaneWindow";
however, the updated  div is the div in which the form is in.

Any idea?

Thank you in advance,

Harring Figueiredo

Re: [s2]theme="ajax" for form/submit button

Posted by Musachy Barroso <mu...@gmail.com>.
Is the target div on a different frame?

musachy

On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
>
> Musachy,
>
> Thanks for the reply.
>
> I am using only one div with the id.
>
> I now tried something else while waiting for the reply:
>
> <s:set name"frame"  value="LoginWindow"/>
> <s:if test="hasActionErrors">
> <s:set name"frame"  value="RightPaneWindow"/>
> </s:if>
>
> I then tried to replace the "traget" on the form itself (since it works on
> the form) with:
> <s:form action="member_login.action" theme="ajax" target="#frame"
> validate="true">
> and also tried with
> <s:form action="member_login.action" theme="ajax" target="<s:param
> name='value' value='#frame' " validate="true">
>
> Howver I cannot get the rigyht syntax to substitue the correct string.
>
> I think that it would work both ways.. But I would prefer to get the
> ajax/targets working.
>
> Harring
>
> On 4/24/07, Musachy Barroso <mu...@gmail.com> wrote:
> >
> > After the ajax request completes, for each target in the target list
> this
> > will run:
> >
> > dojo.byId("id").innerHTML = text;
> >
> > try updating the div content like that, and see what happens. This is a
> > dumb
> > question, but are you using the same id for more than one div?
> >
> > musachy
> >
> > On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> > >
> > > Folks,
> > >
> > > I have a form with a submit button as follows
> > >
> > > <s:form action="member_login.action" theme="ajax" validate="true">
> > >     <s:textfield key="username" />
> > >     <s:password key="password" showPassword="false"/>
> > >     <s:submit key="button.save" theme="ajax" targets="RightPaneWindow"
> > />
> > >     <s:reset key="button.reset"/>
> > > </s:form>
> > >
> > > On the page itself, I have an IFrame with the div="RightPaneWindow";
> > > however, the updated  div is the div in which the form is in.
> > >
> > > Any idea?
> > >
> > > Thank you in advance,
> > >
> > > Harring Figueiredo
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
>
>
>
> --
> Sincerely,
>
> Harring Figueiredo
> Sr. Software Engineer
> Email: harringf@gmail.com
> Telephone: 941-256-0600
>
> "We never become truly spiritual by sitting down and wishing to become so.
> You must undertake something so great that you cannot accomplish it
> unaided."
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: [s2]theme="ajax" for form/submit button

Posted by Musachy Barroso <mu...@gmail.com>.
The "targets" won't be updated if they are in another frame, you can do
something like this:

<s:submit theme="ajax" notifyTopics="/updateIframe" />

<script>
dojo.event.topics.subscribe("/updateIframe", function(data, type, e) {
  if(type == "load") {
     //use iframe index or name here
     window.iframe[0].document.getElementById("divId").innerHTML = data;
  }
});
</script>

musachy

On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
>
> Hmmmm... I sm not sure I understood. Maybe the generated code is different
> for:
> <form target="someT" ..?
>
> then for :
> <s:submit targets="someT" />
>
> ???
>
> If the target is used on the form, it does reference and update the right
> form (But I have to IFrames that I need to update and that is the reason I
> am using the <s:submit :->.
>
> Harring.
>
> On 4/24/07, Musachy Barroso <mu...@gmail.com> wrote:
> >
> > I think that's why it doesn't work, the ajax theme uses
> > getElementBydId(id)
> > (actually dojo.byId(), anyway) which returns the element in the current
> > document, for an iframe it should be
> > window.frames[0].document.getElementById(...).
> > You can use the notifyTopics attribute and do it yourself inside the
> > topic.
> >
> > regards
> > musachy
> >
> > On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> > >
> > > This is the generated code:
> > >
> > > <td colspan="2"><div align="right">    <input type="submit"
> > > dojoType="struts:Bind" event="onclick"     value="Save"
> > >         id="member_login_button_save"    label="Save"   name="
> > button.save"
> > >   targets="RightPaneWindow"  />
> > >
> > > </div>
> > >
> > >
> > > The div is on a different IFrame.
> > >
> > > Harring
> > >
> > > On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> > > >
> > > >
> > > > Musachy,
> > > >
> > > > Thanks for the reply.
> > > >
> > > >  I am using only one div with the id.
> > > >
> > > > I now tried something else while waiting for the reply:
> > > >
> > > > <s:set name"frame"  value="LoginWindow"/>
> > > > <s:if test="hasActionErrors">
> > > > <s:set name"frame"  value="RightPaneWindow"/>
> > > > </s:if>
> > > >
> > > > I then tried to replace the "traget" on the form itself (since it
> > works
> > > on
> > > > the form) with:
> > > > <s:form action="member_login.action" theme="ajax" target="#frame"
> > > > validate="true">
> > > > and also tried with
> > > > <s:form action="member_login.action" theme="ajax" target="<s:param
> > > > name='value' value='#frame' " validate="true">
> > > >
> > > > Howver I cannot get the rigyht syntax to substitue the correct
> string.
> > > >
> > > > I think that it would work both ways.. But I would prefer to get the
> > > > ajax/targets working.
> > > >
> > > > Harring
> > > >
> > > > On 4/24/07, Musachy Barroso <mu...@gmail.com> wrote:
> > > > >
> > > > > After the ajax request completes, for each target in the target
> list
> > > > > this
> > > > > will run:
> > > > >
> > > > > dojo.byId("id").innerHTML = text;
> > > > >
> > > > > try updating the div content like that, and see what happens. This
> > is
> > > a
> > > > > dumb
> > > > > question, but are you using the same id for more than one div?
> > > > >
> > > > > musachy
> > > > >
> > > > > On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> > > > > >
> > > > > > Folks,
> > > > > >
> > > > > > I have a form with a submit button as follows
> > > > > >
> > > > > > <s:form action="member_login.action" theme="ajax"
> validate="true">
> > > > > >     <s:textfield key="username" />
> > > > > >     <s:password key="password" showPassword="false"/>
> > > > > >     <s:submit key="button.save" theme="ajax"
> > > targets="RightPaneWindow"
> > > > > />
> > > > > >     <s:reset key=" button.reset"/>
> > > > > > </s:form>
> > > > > >
> > > > > > On the page itself, I have an IFrame with the
> > div="RightPaneWindow";
> > > > > > however, the updated  div is the div in which the form is in.
> > > > > >
> > > > > > Any idea?
> > > > > >
> > > > > > Thank you in advance,
> > > > > >
> > > > > > Harring Figueiredo
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > "Hey you! Would you help me to carry the stone?" Pink Floyd
> > > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
>
>
>
> --
> Sincerely,
>
> Harring Figueiredo
> Sr. Software Engineer
> Email: harringf@gmail.com
> Telephone: 941-256-0600
>
> "We never become truly spiritual by sitting down and wishing to become so.
> You must undertake something so great that you cannot accomplish it
> unaided."
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: [s2]theme="ajax" for form/submit button

Posted by Harring Figueiredo <ha...@gmail.com>.
Hmmmm... I sm not sure I understood. Maybe the generated code is different
for:
<form target="someT" ..?

then for :
<s:submit targets="someT" />

???

If the target is used on the form, it does reference and update the right
form (But I have to IFrames that I need to update and that is the reason I
am using the <s:submit :->.

Harring.

On 4/24/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> I think that's why it doesn't work, the ajax theme uses
> getElementBydId(id)
> (actually dojo.byId(), anyway) which returns the element in the current
> document, for an iframe it should be
> window.frames[0].document.getElementById(...).
> You can use the notifyTopics attribute and do it yourself inside the
> topic.
>
> regards
> musachy
>
> On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> >
> > This is the generated code:
> >
> > <td colspan="2"><div align="right">    <input type="submit"
> > dojoType="struts:Bind" event="onclick"     value="Save"
> >         id="member_login_button_save"    label="Save"   name="
> button.save"
> >   targets="RightPaneWindow"  />
> >
> > </div>
> >
> >
> > The div is on a different IFrame.
> >
> > Harring
> >
> > On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> > >
> > >
> > > Musachy,
> > >
> > > Thanks for the reply.
> > >
> > >  I am using only one div with the id.
> > >
> > > I now tried something else while waiting for the reply:
> > >
> > > <s:set name"frame"  value="LoginWindow"/>
> > > <s:if test="hasActionErrors">
> > > <s:set name"frame"  value="RightPaneWindow"/>
> > > </s:if>
> > >
> > > I then tried to replace the "traget" on the form itself (since it
> works
> > on
> > > the form) with:
> > > <s:form action="member_login.action" theme="ajax" target="#frame"
> > > validate="true">
> > > and also tried with
> > > <s:form action="member_login.action" theme="ajax" target="<s:param
> > > name='value' value='#frame' " validate="true">
> > >
> > > Howver I cannot get the rigyht syntax to substitue the correct string.
> > >
> > > I think that it would work both ways.. But I would prefer to get the
> > > ajax/targets working.
> > >
> > > Harring
> > >
> > > On 4/24/07, Musachy Barroso <mu...@gmail.com> wrote:
> > > >
> > > > After the ajax request completes, for each target in the target list
> > > > this
> > > > will run:
> > > >
> > > > dojo.byId("id").innerHTML = text;
> > > >
> > > > try updating the div content like that, and see what happens. This
> is
> > a
> > > > dumb
> > > > question, but are you using the same id for more than one div?
> > > >
> > > > musachy
> > > >
> > > > On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> > > > >
> > > > > Folks,
> > > > >
> > > > > I have a form with a submit button as follows
> > > > >
> > > > > <s:form action="member_login.action" theme="ajax" validate="true">
> > > > >     <s:textfield key="username" />
> > > > >     <s:password key="password" showPassword="false"/>
> > > > >     <s:submit key="button.save" theme="ajax"
> > targets="RightPaneWindow"
> > > > />
> > > > >     <s:reset key=" button.reset"/>
> > > > > </s:form>
> > > > >
> > > > > On the page itself, I have an IFrame with the
> div="RightPaneWindow";
> > > > > however, the updated  div is the div in which the form is in.
> > > > >
> > > > > Any idea?
> > > > >
> > > > > Thank you in advance,
> > > > >
> > > > > Harring Figueiredo
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > "Hey you! Would you help me to carry the stone?" Pink Floyd
> > > >
> > >
> > >
> > >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
Sincerely,

Harring Figueiredo
Sr. Software Engineer
Email: harringf@gmail.com
Telephone: 941-256-0600

"We never become truly spiritual by sitting down and wishing to become so.
You must undertake something so great that you cannot accomplish it
unaided."

Re: [s2]theme="ajax" for form/submit button

Posted by Musachy Barroso <mu...@gmail.com>.
I think that's why it doesn't work, the ajax theme uses getElementBydId(id)
(actually dojo.byId(), anyway) which returns the element in the current
document, for an iframe it should be
window.frames[0].document.getElementById(...).
You can use the notifyTopics attribute and do it yourself inside the topic.

regards
musachy

On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
>
> This is the generated code:
>
> <td colspan="2"><div align="right">    <input type="submit"
> dojoType="struts:Bind" event="onclick"     value="Save"
>         id="member_login_button_save"    label="Save"   name="button.save"
>   targets="RightPaneWindow"  />
>
> </div>
>
>
> The div is on a different IFrame.
>
> Harring
>
> On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> >
> >
> > Musachy,
> >
> > Thanks for the reply.
> >
> >  I am using only one div with the id.
> >
> > I now tried something else while waiting for the reply:
> >
> > <s:set name"frame"  value="LoginWindow"/>
> > <s:if test="hasActionErrors">
> > <s:set name"frame"  value="RightPaneWindow"/>
> > </s:if>
> >
> > I then tried to replace the "traget" on the form itself (since it works
> on
> > the form) with:
> > <s:form action="member_login.action" theme="ajax" target="#frame"
> > validate="true">
> > and also tried with
> > <s:form action="member_login.action" theme="ajax" target="<s:param
> > name='value' value='#frame' " validate="true">
> >
> > Howver I cannot get the rigyht syntax to substitue the correct string.
> >
> > I think that it would work both ways.. But I would prefer to get the
> > ajax/targets working.
> >
> > Harring
> >
> > On 4/24/07, Musachy Barroso <mu...@gmail.com> wrote:
> > >
> > > After the ajax request completes, for each target in the target list
> > > this
> > > will run:
> > >
> > > dojo.byId("id").innerHTML = text;
> > >
> > > try updating the div content like that, and see what happens. This is
> a
> > > dumb
> > > question, but are you using the same id for more than one div?
> > >
> > > musachy
> > >
> > > On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> > > >
> > > > Folks,
> > > >
> > > > I have a form with a submit button as follows
> > > >
> > > > <s:form action="member_login.action" theme="ajax" validate="true">
> > > >     <s:textfield key="username" />
> > > >     <s:password key="password" showPassword="false"/>
> > > >     <s:submit key="button.save" theme="ajax"
> targets="RightPaneWindow"
> > > />
> > > >     <s:reset key=" button.reset"/>
> > > > </s:form>
> > > >
> > > > On the page itself, I have an IFrame with the div="RightPaneWindow";
> > > > however, the updated  div is the div in which the form is in.
> > > >
> > > > Any idea?
> > > >
> > > > Thank you in advance,
> > > >
> > > > Harring Figueiredo
> > > >
> > >
> > >
> > >
> > > --
> > > "Hey you! Would you help me to carry the stone?" Pink Floyd
> > >
> >
> >
> >
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: [s2]theme="ajax" for form/submit button

Posted by Harring Figueiredo <ha...@gmail.com>.
This is the generated code:

 <td colspan="2"><div align="right">    <input type="submit"
dojoType="struts:Bind" event="onclick"     value="Save"
  	id="member_login_button_save"    label="Save"  	name="button.save"
  targets="RightPaneWindow"  />

</div>


The div is on a different IFrame.

Harring

On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
>
>
> Musachy,
>
> Thanks for the reply.
>
>  I am using only one div with the id.
>
> I now tried something else while waiting for the reply:
>
> <s:set name"frame"  value="LoginWindow"/>
> <s:if test="hasActionErrors">
> <s:set name"frame"  value="RightPaneWindow"/>
> </s:if>
>
> I then tried to replace the "traget" on the form itself (since it works on
> the form) with:
> <s:form action="member_login.action" theme="ajax" target="#frame"
> validate="true">
> and also tried with
> <s:form action="member_login.action" theme="ajax" target="<s:param
> name='value' value='#frame' " validate="true">
>
> Howver I cannot get the rigyht syntax to substitue the correct string.
>
> I think that it would work both ways.. But I would prefer to get the
> ajax/targets working.
>
> Harring
>
> On 4/24/07, Musachy Barroso <mu...@gmail.com> wrote:
> >
> > After the ajax request completes, for each target in the target list
> > this
> > will run:
> >
> > dojo.byId("id").innerHTML = text;
> >
> > try updating the div content like that, and see what happens. This is a
> > dumb
> > question, but are you using the same id for more than one div?
> >
> > musachy
> >
> > On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> > >
> > > Folks,
> > >
> > > I have a form with a submit button as follows
> > >
> > > <s:form action="member_login.action" theme="ajax" validate="true">
> > >     <s:textfield key="username" />
> > >     <s:password key="password" showPassword="false"/>
> > >     <s:submit key="button.save" theme="ajax" targets="RightPaneWindow"
> > />
> > >     <s:reset key=" button.reset"/>
> > > </s:form>
> > >
> > > On the page itself, I have an IFrame with the div="RightPaneWindow";
> > > however, the updated  div is the div in which the form is in.
> > >
> > > Any idea?
> > >
> > > Thank you in advance,
> > >
> > > Harring Figueiredo
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
>
>
>

Re: [s2]theme="ajax" for form/submit button

Posted by Harring Figueiredo <ha...@gmail.com>.
Musachy,

Thanks for the reply.

 I am using only one div with the id.

I now tried something else while waiting for the reply:

<s:set name"frame"  value="LoginWindow"/>
<s:if test="hasActionErrors">
<s:set name"frame"  value="RightPaneWindow"/>
</s:if>

I then tried to replace the "traget" on the form itself (since it works on
the form) with:
<s:form action="member_login.action" theme="ajax" target="#frame"
validate="true">
and also tried with
<s:form action="member_login.action" theme="ajax" target="<s:param
name='value' value='#frame' " validate="true">

Howver I cannot get the rigyht syntax to substitue the correct string.

I think that it would work both ways.. But I would prefer to get the
ajax/targets working.

Harring

On 4/24/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> After the ajax request completes, for each target in the target list this
> will run:
>
> dojo.byId("id").innerHTML = text;
>
> try updating the div content like that, and see what happens. This is a
> dumb
> question, but are you using the same id for more than one div?
>
> musachy
>
> On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
> >
> > Folks,
> >
> > I have a form with a submit button as follows
> >
> > <s:form action="member_login.action" theme="ajax" validate="true">
> >     <s:textfield key="username" />
> >     <s:password key="password" showPassword="false"/>
> >     <s:submit key="button.save" theme="ajax" targets="RightPaneWindow"
> />
> >     <s:reset key="button.reset"/>
> > </s:form>
> >
> > On the page itself, I have an IFrame with the div="RightPaneWindow";
> > however, the updated  div is the div in which the form is in.
> >
> > Any idea?
> >
> > Thank you in advance,
> >
> > Harring Figueiredo
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
Sincerely,

Harring Figueiredo
Sr. Software Engineer
Email: harringf@gmail.com
Telephone: 941-256-0600

"We never become truly spiritual by sitting down and wishing to become so.
You must undertake something so great that you cannot accomplish it
unaided."

Re: [s2]theme="ajax" for form/submit button

Posted by Musachy Barroso <mu...@gmail.com>.
After the ajax request completes, for each target in the target list this
will run:

dojo.byId("id").innerHTML = text;

try updating the div content like that, and see what happens. This is a dumb
question, but are you using the same id for more than one div?

musachy

On 4/24/07, Harring Figueiredo <ha...@gmail.com> wrote:
>
> Folks,
>
> I have a form with a submit button as follows
>
> <s:form action="member_login.action" theme="ajax" validate="true">
>     <s:textfield key="username" />
>     <s:password key="password" showPassword="false"/>
>     <s:submit key="button.save" theme="ajax" targets="RightPaneWindow" />
>     <s:reset key="button.reset"/>
> </s:form>
>
> On the page itself, I have an IFrame with the div="RightPaneWindow";
> however, the updated  div is the div in which the form is in.
>
> Any idea?
>
> Thank you in advance,
>
> Harring Figueiredo
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd