We have a link on a page that does a submit and pops up a new window once the
form has been submitted.

The code is based on the PopupLinkSubmit example here:
http://wiki.apache.org/tapestry/PopupLinkSubmit

This all works fine on 4.0.2 but under 4.1.4-SNAPSHOT we get the following
error when the page opens up:

2007-11-06 18:35:10,197, ERROR,
[org.apache.tapestry.services.impl.HiveMindExpressionCompiler], line 227,
Error generating OGNL statements for expression class with root
{href=javascript:submitPopupLink('editorForm',
'PopupLinkSubmit','/GQ/Waiting.page');,
[EMAIL PROTECTED]/editor.editorForm], class=action,
popupLink=/GQ/Waiting.page, name=PopupLinkSubmit}
org.apache.hivemind.ApplicationRuntimeException: Unable to add method void
set(ognl.OgnlContext, java.lang.Object, java.lang.Object) to class
$ASTProperty_116174fa4f8: [source error]
put(java.lang.String,java.lang.Object) not found in java.lang.Object
      at
org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
      at
org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:217)
      at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
      at ognl.Ognl.compileExpression(Ognl.java:141)
...
Caused by: javassist.CannotCompileException: [source error]
put(java.lang.String,java.lang.Object) not found in java.lang.Object
      at javassist.CtBehavior.setBody(CtBehavior.java:347)
      at javassist.CtBehavior.setBody(CtBehavior.java:316)
      at
org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:272)
      ... 137 more
Caused by: compile error: put(java.lang.String,java.lang.Object) not found in
java.lang.Object
      at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:716)
      at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:681)
      at
javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:156)
      at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
      at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:235)
      at javassist.compiler.CodeGen.atStmnt(CodeGen.java:323)
      at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344)
      at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:285)
      at javassist.compiler.Javac.compileBody(Javac.java:212)
      at javassist.CtBehavior.setBody(CtBehavior.java:341)
      ... 139 more

Here's what's on the page:

      <a href="#"
         jwcid="@PopupLinkSubmit"
         listener="listener:openEditorGraph"
         popuppage="Waiting"
         styleClass="action"
         windowWidth="840"
         windowHeight="550">
        Generate Plot
      </a>


Here's PopupLinkSubmit.script

<?xml version="1.0"?>
<!DOCTYPE script PUBLIC
        "-//Apache Software Foundation//Tapestry Script Specification 3.0//EN"
        "http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd";>
<script>

<input-symbol key="name" class="java.lang.String" required="yes"/>
<input-symbol key="popupLink" class="java.lang.String" required="yes"/>
<input-symbol key="form" class="org.apache.tapestry.IForm" required="yes"/>
<input-symbol key="class" class="java.lang.String" required="no"/>

<let key="href">
  javascript:submitPopupLink('${form.name}', '${name}','${popupLink}');
</let>

<let key="class">
  ${class}
</let>

</script>

Which comes out as:

      <a href="javascript:submitPopupLink('editorForm',
'PopupLinkSubmit','/GQ/Waiting.page');" class="action">
        Generate Plot
      </a>

The Javascript we're rendering in PopupLinkSubmit.java comes out as:

function submitPopupLink(form, elementId, url)
{
  var windowName = 'RDQGraphPopup';
  var randomNumber = Math.floor(Math.random()*1000);
  windowName = windowName+randomNumber;
  aWindow = window.open(url, windowName, 'width=840, height=800,
scrollbars=yes,resizable=yes', false);
  aWindow.focus();
  var form = document.getElementById(form);
  form.target=windowName;
  form.events.submit(elementId);
  form.target='';
}

I can supply the rest of the source if required but it's basically following
the example I mentioned at the top.

The rendered versions of the link and the Javascript are the same as under
4.0.2 but we get the above error in the back end and the link does not work.
We get a Javascript error stating that 'events' is null or not an object.
This is referring to this line:
  form.events.submit(elementId);
Which seems to be related to issues mentioned here
http://tapestry.apache.org/tapestry4.1/usersguide/upgrade4.0.html
Can anyone let me know what we should be doing instead of form.events.submit?
The documentation does not make it clear what the replacement is

If we fix the form.events issues will that also fix the error we see when the
page loads up or is that an unrelated error?

Any ideas would be appreciated.

Dom

---

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.


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

Reply via email to