You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ingo Villnow <in...@googlemail.com> on 2007/10/31 15:19:12 UTC
struts 1.2: calling an action by javascript
Hello,
i want to call an action by javascript, when a value in a <html:select>
field changes. I want to fill my <html:form> with the data provided by
the action. Any ideas? I don't know a lot of javascript :-(
thanks & greetings from Berlin
Re: struts 1.2: calling an action by javascript
Posted by Fátima Silveira <fa...@gmail.com>.
try this
<script language="javascript">
function submitForm(){
//do the verification you want to...
form.submit();
}
</script>
<s:select onchange="submitForm()" .... />
On 10/31/07, Ingo Villnow <in...@googlemail.com> wrote:
>
> Hello,
>
> i want to call an action by javascript, when a value in a <html:select>
> field changes. I want to fill my <html:form> with the data provided by
> the action. Any ideas? I don't know a lot of javascript :-(
>
> thanks & greetings from Berlin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
Re: struts 1.2: calling an action by javascript
Posted by dvdface <dv...@hotmail.com>.
Ingo Villnow wrote:
>
> Hello,
>
> i want to call an action by javascript, when a value in a <html:select>
> field changes. I want to fill my <html:form> with the data provided by
> the action. Any ideas? I don't know a lot of javascript :-(
>
> thanks & greetings from Berlin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
you can use DWR to achieve this job
--
View this message in context: http://www.nabble.com/struts-1.2%3A-calling-an-action-by-javascript-tp13510349p18658906.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts 1.2: calling an action by javascript
Posted by Ingo Villnow <in...@googlemail.com>.
Thank you, I am going to use the javawebparts.ajaxparts taglib in any
way, now i try to find the cook book :-) thanks
Frank W. Zammetti schrieb:
> On Wed, October 31, 2007 10:19 am, Ingo Villnow wrote:
>
>> i want to call an action by javascript, when a value in a <html:select>
>> field changes. I want to fill my <html:form> with the data provided by
>> the action. Any ideas? I don't know a lot of javascript :-(
>>
>
> There's a couple if ways you could do that... one would be to call the
> submit() method of the form object, which every form in HTML has, then
> re-render the page with the updated data in the form. That's of course
> going to refresh the entire page, which I suspect isn't what you want.
>
> So, AJAX is probably what you want. Now, how you go about doing that,
> well, there's a few hundred options :) Because you don't know a lot of
> Javascript, you might want to consider the AjaxParts Taglib (APT) from
> Java Web Parts (JWP):
>
> http://javawebparts.sourceforge.net
>
> Direct to APT:
>
> http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html
>
> If you go to the download page, the cookbook has some examples that are
> very much along the lines of what you're asking for. If you go that
> route, we'll be more than happy on the JWP mailing list, or forums.
>
> Otherwise, prototype (http://www.prototypejs.org) is a good, simple
> option, but you will be writing some Javascript.
>
>
>> thanks & greetings from Berlin
>>
>
> hth,
> Frank
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
Re: struts 1.2: calling an action by javascript
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
On Wed, October 31, 2007 10:19 am, Ingo Villnow wrote:
> i want to call an action by javascript, when a value in a <html:select>
> field changes. I want to fill my <html:form> with the data provided by
> the action. Any ideas? I don't know a lot of javascript :-(
There's a couple if ways you could do that... one would be to call the
submit() method of the form object, which every form in HTML has, then
re-render the page with the updated data in the form. That's of course
going to refresh the entire page, which I suspect isn't what you want.
So, AJAX is probably what you want. Now, how you go about doing that,
well, there's a few hundred options :) Because you don't know a lot of
Javascript, you might want to consider the AjaxParts Taglib (APT) from
Java Web Parts (JWP):
http://javawebparts.sourceforge.net
Direct to APT:
http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html
If you go to the download page, the cookbook has some examples that are
very much along the lines of what you're asking for. If you go that
route, we'll be more than happy on the JWP mailing list, or forums.
Otherwise, prototype (http://www.prototypejs.org) is a good, simple
option, but you will be writing some Javascript.
> thanks & greetings from Berlin
hth,
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts 1.2: calling an action by javascript
Posted by lavanyaonnet <la...@gmail.com>.
Hi,
I too have littile bit knolwledge in javascript, plz try this
<script language="javascript">
function submitFunction(){
document.forms(0).submit();
}
</script>
<script language="javascript">
function submitaddFunction(){
document.forms(1).submit();
}
</script>
just call the above function in ur button tag.
Ingo Villnow wrote:
>
> Hello,
>
> i want to call an action by javascript, when a value in a <html:select>
> field changes. I want to fill my <html:form> with the data provided by
> the action. Any ideas? I don't know a lot of javascript :-(
>
> thanks & greetings from Berlin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
View this message in context: http://www.nabble.com/struts-1.2%3A-calling-an-action-by-javascript-tp13510349p17485073.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts 1.2: calling an action by javascript
Posted by "prasad.dls" <pr...@gmail.com>.
This is select box. u make this as html select
<select name="contentId" id="contentId"
onchange="getPage(<%=companyId%>,'./xxx.do?step=<bean:message
key="link.xxxx.xxxxx"/>&contentId=');">
This is javascript
--
function getPage(ccid,url){
var cId = document.getElementById("contentId").value;
document.location.href = url+cId+'&xxxId='+ccid;
}
by using this u can get what u want.
Ingo Villnow wrote:
>
> Hello,
>
> i want to call an action by javascript, when a value in a <html:select>
> field changes. I want to fill my <html:form> with the data provided by
> the action. Any ideas? I don't know a lot of javascript :-(
>
> thanks & greetings from Berlin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
View this message in context: http://www.nabble.com/struts-1.2%3A-calling-an-action-by-javascript-tp13510349p14592253.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts 1.2: calling an action by javascript
Posted by Friend Here <sa...@gmail.com>.
<html:select onchange = "submit();" >
function submit()
{
populate values ..........then
document.action.value = " /url ";
document[0].forms[0].submit();
}
Ingo Villnow wrote:
>
> Hello,
>
> i want to call an action by javascript, when a value in a <html:select>
> field changes. I want to fill my <html:form> with the data provided by
> the action. Any ideas? I don't know a lot of javascript :-(
>
> thanks & greetings from Berlin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
View this message in context: http://www.nabble.com/struts-1.2%3A-calling-an-action-by-javascript-tf4725382.html#a13723779
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: struts 1.2: calling an action by javascript
Posted by Martin Gainty <mg...@hotmail.com>.
Good Morning-
What you're looking for is a technology called Direct Web Remoting take a look at StrutsCreator at
http://directwebremoting.org/dwr/server/struts
HTH
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
> Date: Fri, 31 Oct 2008 02:44:49 -0700
> From: sachin_kt@yahoo.com
> To: user@struts.apache.org
> Subject: Re: struts 1.2: calling an action by javascript
>
>
> Yes, you can do so by using AJAX, you need to invoke a Javascript function
> that makes an AJAX call to the action.
>
> Thanks,
> Sachin
>
> Ingo Villnow wrote:
> >
> > Hello,
> >
> > i want to call an action by javascript, when a value in a <html:select>
> > field changes. I want to fill my <html:form> with the data provided by
> > the action. Any ideas? I don't know a lot of javascript :-(
> >
> > thanks & greetings from Berlin
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
> --
> View this message in context: http://www.nabble.com/struts-1.2%3A-calling-an-action-by-javascript-tp13510349p20262635.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
_________________________________________________________________
Store, manage and share up to 5GB with Windows Live SkyDrive.
http://skydrive.live.com/welcome.aspx?provision=1?ocid=TXT_TAGLM_WL_skydrive_102008
Re: struts 1.2: calling an action by javascript
Posted by Sachint <sa...@yahoo.com>.
Yes, you can do so by using AJAX, you need to invoke a Javascript function
that makes an AJAX call to the action.
Thanks,
Sachin
Ingo Villnow wrote:
>
> Hello,
>
> i want to call an action by javascript, when a value in a <html:select>
> field changes. I want to fill my <html:form> with the data provided by
> the action. Any ideas? I don't know a lot of javascript :-(
>
> thanks & greetings from Berlin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
View this message in context: http://www.nabble.com/struts-1.2%3A-calling-an-action-by-javascript-tp13510349p20262635.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org