Hmmm that's odd - I mean the form has a default value for _eventName so even
if the javascript didn't work, it should still run the start() method, not
the @DefaultHandler. I wonder what else I might be doing wrong here.
Alex
On Sat, Nov 8, 2008 at 2:50 PM, Aaron Porter <[EMAIL PROTECTED]> wrote:
> Alex,
> I'd check the JavaScript to make sure it is actually setting the value for
> the hidden field. It could be failing if you're selecting the hidden field
> by id because the id you're using is invalid IIRC (shouldn't use
> underscore). If you've got Firebug you can see the fields that were actually
> sent.
>
> I do know that _eventName works and I believe it will override anything
> else.
>
> Aaron
>
> Alex Turner wrote:
>
> I think I read on an earlier mailing list entry that I could use a form
> field name _eventName to dynamically select which event handler I wanted. I
> have a form where the _eventName field is modified by some javascript, but
> it doesn't seem to work, it's just calling the @DefaultHandler method.
>
> I know the javascript is working because I previously had the field named
> action and I was just making it a member variable, but I can't do that
> because I need to change what I validate depending on the action.
>
> Here is the form:
>
> <h2>Today's Timesheet</h2>
> <s:errors field="projectId"/>
> <s:form
> beanclass="com.tmdworldwide.projectmanager.web.TimeTrackerActionBean"
> name="timetrackerForm" id="timetrackerForm">
> <s:hidden name="_eventName" id="_eventName" value="start"/>
> <table class="Timesheet">
> <tbody>
> <tr class="New">
> <td colspan="3">
> <s:select name="projectId">
> <s:option value="">Select a
> Project...</s:option>
> <s:options-collection
> collection="${actionBean.data.projects}" value="id" label="name"/>
> </s:select>
> </td>
> <td class="Action"><a href="javascript:
> startTimetracker()" class="Start">Start</a></td>
> </tr>
> <c:forEach items="${actionBean.data.workItems}"
> var="workItem">
> <c:choose>
> <c:when test="${workItem.tracking}">
> <tr class="Tracking">
> </c:when>
> <c:otherwise>
> <tr>
> </c:otherwise>
> </c:choose>
> <td
> class="StartTime"><strong><fmt:formatDate value="${workItem.startTimestamp}"
>
> type="time"/></strong></td>
> <td class="Job">
> ${workItem.project.name}
> <c:if test="${workItem.tracking}">
> <input type="hidden"
> name="workItemId" value="${workItem.id}"/>
> </c:if>
> </td>
> <td class="TimeLogged">
>
> ${workItem.hoursFormatted}:${workItem.minutesFormatted}
> </td>
> <td>
> <c:if test="${workItem.tracking}">
> <a href="javascript:
> stopTimetracker()" class="Stop">Stop</a>
> </c:if>
> </td>
> </tr>
> </c:forEach>
> </tbody>
> </table>
> </s:form>
>
> Thanks agains for all your wonderful help!
>
> Alex
>
> ------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> worldhttp://moblin-contest.org/redirect.php?banner_id=100&url=/
>
> ------------------------------
>
> _______________________________________________
> Stripes-users mailing [EMAIL
> PROTECTED]://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users