I've searched the spring forums and still havent found any answer to my
question. I'm wondering if the spring form tags are preventing me to execute
a javascript submit(). Anyways, my fix for now was to just grab the submit
button on the page and do a click() event.

I thought someone here might of ran into this problem. Thanks.


On 4/9/07, Matt Campbell <[EMAIL PROTECTED]> wrote:

Hello,

Is it possible to submit a spring form via a javascript call? I know the
Spring form tags are tied to the command object, would this cause a problem
with calling it from javascript? I need to submit a form via a <form:select>
onchange event. I've gotten ahold of the form and whenever i try to call
form.submit() i get a javascript error:  "form.submit is not a function".


Heres my jsp:


<
script language="Javascript" >

function procFormSubmission()

{

var
form = document.getElementById("findPastWinningNumbersForm");

alert(form.action);

form.action =
"findPastWinningNumbers.html?mode=update";

alert(form.action);

form.submit();

}

</script>

<spring:bind path="findPastWinningNumbers.*" >

<c:if test="${*not empty *status.errorMessages}">

<div class="error" >

<c:forEach var="error" items="${status.errorMessages}">

<img src="< c:url value="/images/iconWarning.gif" />" alt="<fmt:message
key="icon.warning"/>" class="icon"/>

<c:out value="${error}" escapeXml="false"/><br />

</c:forEach>

</div>

</c:if>

</spring:bind>

<form:form commandName= "findPastWinningNumbers" method="post" action ="
findPastWinningNumbers.html?mode=submit" id="findPastWinningNumbersForm" >

<table>

<tr>

<td>Select a Game</ td>

<td>

<form:select path="gameId" items="${gameList}" itemValue="id" 
itemLabel="gamGameDesc"
onchange="javascript:procFormSubmission()" ></form:select>

</td>

</tr>

<tr>

<td>Draw Type</ td>

<td>

<form:select path="drawTypeId" items="${drawTypes}" itemValue="id"
itemLabel="drawTypeDesc" />

</td>

</tr>

<tr>

<td>Draw Date</ td>

<td>

<form:input path="date" id="date" cssClass= "text small" readonly=
"readonly"/>

<button type="reset" id="f_trigger_b" style= "width:30px">...</button>

</td>

</tr>

<tr>

<td />

<td>

<input type="submit" class="button" name= "submit" value="Find" />

</td>

</tr>

</table>

</form:form>

Reply via email to