I added a kind of dummy ajax submit link on that form and then try to invoke
that link... When I get a reference to the callback URL. Here is the error.
Is there a way to debug that object error? I could try changing:
1. ignore if not active to false?
2. changing some of the parameters to the submit call?
3. hiddenSubmitLink ...maybe that is not the correct path to that link... Maybe
I need to try
panel:form:hiddenSubmitLink...etc?
>From the Debug Window:
INFO:
<?xml version="1.0" encoding="UTF-8"?><ajax-response><evaluate><![CDATA[var
wcall=wicketSubmitFormById('form5e',
'?wicket:interface=:0:panel:form:hiddenSubmitLink::IActivePageBehaviorListener:0:-1&wicket:ignoreIfNotActive=true',
'hiddenSubmitLink' ,function() { }.bind(this),function() { }.bind(this),
function() {return Wicket.$$(this)&&Wicket.$$('form5e')}.bind(this));;; return
false;]]></evaluate></ajax-response>
INFO: Response parsed. Now invoking steps...
ERROR: Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript:
[object Error]
INFO: Response processed successfully.
-----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]