multiple submit buttons in a single form

cilquirm <[email protected]>
Newsgroups gmane.comp.java.open-symphony.webwork
Message-ID <29376061.1150324616924.JavaMail.os-j2ee@opensymphony01.managed.contegix.com>
(long data at end)

Hi, 

I'm trying to use multiple submit buttons in a single form ( i.e. a button for 'Preview' and a button for 'Save' ).  The Preview button is meant to render to another div and calls a separate action than the base form. The save button should call the default action and redirect as appropriate.

However, after the page renders, the preview button seems to call the main action and stuff it into the  DIV, and the save button does nothing

I have the ajax theme enabled by default in my webwork. properties ( webwork.ui.theme = ajax )

Using the default xhtml theme, the independent actions are called correctly, but obviously, the remoteDiv stuff doesn't work.

I can't figure out what I'm doing wrong, so any help would be appreciated.

Thanks in advance,

-a



This is my page :


<%@ taglib prefix="ww" uri="/WEB-INF/webwork.tld" %>
<html>
<head>
	<title>Save List to CMS</title>
	<ww:head theme="ajax"/>
</head>
<body>


<h2>Save List to CMS </h2>
<div id="previewContent" style="float:right; border: 1px solid black; width: 500px">
Select PREVIEW to Preview the List before Submitting
</div>

<ww:form id="save" name="save" namespace="/lists" action="save" >
<ww:textfield label="List ID" name="listId"/>
<ww:submit id="previewButton" type="button" value="Preview" action="preview" resultDivId="previewContent" />
<ww:submit id="saveButton" value="Save" action="save" /> 
</ww:form>
</body>
</html>	




This is the resulting HTML :


html>
<head>
	<title>Save List to CMS</title>
	<link rel="stylesheet" href="/author/webwork/xhtml/styles.css" type="text/css"/>
<link rel="stylesheet" href="/author/webwork/jscalendar/calendar-blue.css" type="text/css"/>
<script language="JavaScript" type="text/javascript">
    // Dojo configuration
    djConfig = {
        baseRelativePath: "/author/webwork/dojo/",
        isDebug: false,
        bindEncoding: "UTF-8",
        debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes
    };
</script>
<script language="JavaScript" type="text/javascript"
        src="/author/webwork/dojo/dojo.js"></script>
<script language="JavaScript" type="text/javascript"
        src="/author/webwork/ajax/dojoRequire.js"></script>
<script language="JavaScript" type="text/javascript"
        src="/author/webwork/CommonFunctions.js"></script>

</head>
<body>


<h2>Save List to CMS </h2>
<div id="previewContent" style="float:right; border: 1px solid black; width: 500px">
Select PREVIEW to Preview the List before Submitting
</div>

<form namespace="/lists" id="save" name="save" action="/author/lists/save.action" 
 onSubmit="return isAjaxFormSubmit(this);"
>
<table class="wwFormTable">

<tr>
    <td class="tdLabel"><label for="save_listId" class="label">List ID:</label></td>

    <td>
<input type="text" name="listId" value="" id="save_listId"/>
</td>
</tr>

<tr>
    <td colspan="2"><div align="right"><button type="submit" dojoType="BindButton" formId="save" name="action:preview" value="Preview" targetDiv="previewContent">Preview</button></div>
</td>
</tr>


<tr>
    <td colspan="2"><div align="right"><input type="submit" name="action:save" value="Save"/>

</div></td>
</tr>
 
<script>

var containingForm = document.getElementById("save");



</script>

</table>
</form>

</body>
</html>
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=34351&messageID=66919#66919

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.