PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 11, 2003 9:15 PM
Subject: newbie question - setting form parameter in Javascript
Hi,
I have an HTML form with Submit and Cancel buttons, and a drop down list,
which when clicked submits the form. I use Javascript to submit the form
when
My Javascript function is given below:
SCRIPT language=JavaScript
function submitForm(form)
{
form.action.value=Lookup;
form.submit();
return true;
}
#
and I invoke this function in my HTML form as shown below:
Mark,
Thanks a lot for your mails. I have used action as a form bean property and not as a
parameter in struts-config. Unfortunately, the Javascript function doesn't seem to
work...it does not set the value of the ActionForm property, action.
When I tried to print out the value of the action
Hi,
I have an HTML form with Submit and Cancel buttons, and a drop down list, which when
clicked submits the form. I use Javascript to submit the form when the dropdown list
is clicked.
I have a property called action defined in my ActionForm class that identifies the
Submit and Cancel
You will need to create a hidden field named action, with a value of
Lookup:
html:hidden property=action value=Lookup/
My question to you iswhy Lookup? What does that have to do with your
form?
Here's a sample:
SCRIPT language=JavaScript
function submitForm(form) {
James,
Thanks for your mail. I guess I need to elaborate a little bit. My HTML form can be
submitted in 2ways.
1. Clicking the Submit button.
2. Clicking the drop-down
Clicking the drop-down triggers a different action than clicking the Submit button.
Selecting a value in the drop-down would
check out dispatch actions..
you can have multiple execute methods with dispatch action ...
Your Action class extends DispatchAction instead of action (check the
docs)
public final ActionForward submit(
ActionMapping mapping,
I think I see where you are goingtry setting the form action instead:
SCRIPT language=JavaScript
function submitForm(form) {
document.frm.action=lookup.do; // --Change this to not be hard-coded
form.submit();
return true;
}
/SCRIPT
form name=frm action=? method=GET
input type=hidden
Its better that this is posted to the list as well, after all its a
good question and hopefully an adequate answer.
script language=javascript type=text/javascript
!--
function lookup(form) {
form.elements['action'].value = lookup;
form.submit();
}
//--
/script
html:form
opps my action in struts config is wrong... But you should still have
the right idea..
On Saturday, July 12, 2003, at 12:45 AM, Mark Lowe wrote:
Its better that this is posted to the list as well, after all its a
good question and hopefully an adequate answer.
script language=javascript
10 matches
Mail list logo