Our solution to this dilemma was to set the eventSubmit_ input element
dynamically using JavaScript (I know...I don't like using JS either :)
).  This is in our global JS include file.

The relevant JS code looks like this...

/*
 * Used for adding a hidden <input/> tag to the search form.
 *
 * form  - The form to submit.
 * event - The action event name.  Maps to a method of the action class.
 * value - Passed to the action event handler.
 */
function invokeActionEvent(form, event, value) {
    // construct the navigation input tag element
    var inputTag = document.createElement("input");
    inputTag.type = "hidden";

    // specify the 'doXxxxxx' action event
    inputTag.name = "eventSubmit_do" + event;
    inputTag.value = value;

    // add the tag to the search form
    document.forms[form].appendChild(inputTag);

    // submit the form
    document.forms[form].submit();

    // remove the tag from the form, because we are done with it
    document.forms[form].removeChild(inputTag);
}

-Mitch

-----Original Message-----
From: Luke Majewski [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 20, 2003 3:11 PM
To: Turbine Users List
Subject: Re: AW: $link.setAction

This works _almost_ :)

I like this suggestion it works very well, but now i have the problem
that I
have two functions being called by two different links, so I have:

<input type="hidden" name="eventSubmit_doExpand" value="1">
<input type="hidden" name="eventSubmit_doAdd" value="1">

and now what happens is that depending on which link I hit, either the
Expand or the Add, the backend function called will always be the same.
So
in other words, if a vist my page, hit "add", it calls the add function
in
my backend.  But then if I hit the "expand" link, it also calls the add
function in my backend.  Any suggestions as to how to, for lack of a
better
word, "clear" the page so that this behavior is not observed?

thank you!

Luke


----- Original Message -----
From: "Jeffery Painter" <[EMAIL PROTECTED]>
To: "Turbine Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, August 20, 2003 5:25 PM
Subject: Re: AW: $link.setAction


>
> You could set the function you want called in your action class in a
> hidden field.
>
> <form
> name="someform"
> method="post"
> action="$link.setAction("myclass").setPage("results.vm")">
>
> <input type="hidden" name="eventSubmit_doAdd" value="1">
> <input type="hidden" name="otherData" value="1">
>
> <a href="javascript:doSubmit()">Add</a>
>
> </form>
>
> It works just as well as using a form submit element.
>
> You should only pass data and context through the doAdd function, use
> data.getParameters() to pull the otherData variable... these variables
> will not be passed directly to
>
> doAdd(Rundata data, Context context)
>
> good luck,
> Jeff Painter
>
> On Wed, 20 Aug 2003, Luke Majewski wrote:
>
> > Right, but the problem here is how do I specify what function I want
called
> > in "myClass" doing it this way.  I don't want a button, I want a
link,
and
> > when I use a link and use the onClick (and submit the form through
> > javascript) it didn't work either.  I'll try a couple other
variations
and
> > get back to everyone about this.
> >
> > Thank you for everyone's help!
> >
> > Luke Majewski
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to