I got it.

But I passed function() { return true; } ... To the post and preconditions. 

-----Original Message-----
From: Igor Vaynberg [mailto:[email protected]] 
Sent: Friday, January 28, 2011 12:52 AM
To: [email protected]
Cc: [email protected]
Subject: Re: Submit form from ajaxlink not a part of the form

add(new ajaxsubmitlink("submit", form));

-igor

On Thu, Jan 27, 2011 at 7:46 PM, Brown, Berlin [GCG-PFS] 
<[email protected]> wrote:
> So, I was able to submit a form WITHOUT ajax.  Now, how can I submit a 
> form with ajax but from a link not associated with that form.  I tried 
> the following.    But, I couldn't get the proper URLs / Button?   Are 
> those needed for the wicketSubmFormById call?
>
> Also, do i have an issue using target.appendJavascript(...);
>
> ...
>
> If you look at the event handler method,
>
> public class MyPanel {
>
> public static final String
> JS_SUBMIT_THIS_WORKS_BUT_HOW_TO_SUBMIT_BY_AJAX = "try { 
> document.forms['%s'].submit(); } catch(err) { alert('ERR:' + err); if 
> (window.console != undefined) { console.log(err); } }";
>
> this.add(new AjaxLink<Object>("link") {
>            @Override
>            public void onClick(final AjaxRequestTarget target) {
>
>                // Find the dynamic form on the page.
>                final Object objAtStopTraversal = 
> getParentContainer().visitChildren(new FindFormVisitor());
>                if (objAtStopTraversal instanceof Form<?>) {
>                    // Form found, invoke javascript submit
>                    final Form<?> form = (Form<?>) objAtStopTraversal;
>
>
> target.appendJavascript(getEventHandler(form.getMarkupId(), ???, 
> this));
>                }
>            }
>        } );
>
> protected CharSequence getEventHandler(final String formMarkupId, 
> final String inputName, final AbstractLink link) {
>        final String formId = formMarkupId;
>        final CharSequence url = ????????????????
>        AppendingStringBuffer call = new AppendingStringBuffer("var
> wcall=wicketSubmitFormById('")
>        .append(formId).append("', '").append(url).append("', ");
>
>        call.append("'")
>        .append(inputName)
>        .append("' ");
>        call.append(",function() { }.bind(this),function() { 
> }.bind(this), function() { }.bind(this));;; return false;;");
>        return call;
>    }
>
> Berlin Brown
>

---------------------------------------------------------------------
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