cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <vijayaraghavan.subraman...@wipro.com>
Subject RE: onChange event handler not working in cocoon-2.1.7
Date Fri, 30 Sep 2005 07:27:10 GMT

Hi,

I'm getting error if we use V3 API in my code?
That's why i tried using V2 API, b'cos found something in Cocoon-2.1.7
Samples

I'm getting the following error while accessing widget value/setting
onChange..

"The undefined value has no properties."

wid.number1.value = 1; // error while accessing widget value

wid.number1.onChange = function(oldValue, newValue) { // error while
setting onChange
   print("number1 changed from " + oldValue + " to " + newValue);
}


My flow script code: -
=====================
cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/v3/Form.
js");

function test() {
   var form = new Form("forms/test-def.xml");
   var wid = frm.getWidget();
 
   wid.number1.value = 1;

   wid.number1.onChange = function(oldValue, newValue) {
    print("number1 changed from " + oldValue + " to " + newValue);
  
  }
  form.showForm("forms/test.html");
}

Definition file:-
================

<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
  <fd:widgets>
    <fd:field id="number1" required="true">
       <fd:label>Please enter a number</fd:label>
       <fd:datatype base="string"/>
     </fd:field>
   </fd:widgets>
</fd:form>

Template file : -
----------------
<html xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
      xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
      xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
...
...
<ft:form-template action="#{$cocoon/continuation/id}.continue"
method="POST">
  <ft:widget id="number1">
    <fi:styling submit-on-change="true"/>
  </ft:widget>
</ft:form-template>
...
...
</html>

Anyone have idea on the same, please help me out.


Vijay.


-----Original Message-----
From: Mark Lundquist [mailto:ml@wrinkledog.com]
Sent: Friday, September 30, 2005 4:07 AM
To: users@cocoon.apache.org
Subject: Re: onChange event handler not working in cocoon-2.1.7



On Sep 29, 2005, at 1:01 PM, Jason Johnston wrote:

>> We are using following resource in cocoon-2.1.5.1 ...
>> cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/v3/
>> Form.
>> js");
>>
>
> Why did you switch flow APIs from v3 to v2?

it looks like his switch was _to_ v3?...

>   The APIs have many
> differences, so it's not surprising they're behaving differently.  I'm
> not
> familiar with anything but v1, but a cursory glance at the javadocs 
> tells
> me v2 doesn't support the .onChange shortcut.

It does, actually... and so does v3.  See their respective versions of 
ScriptableWidget.  I don't think you can tell from the Javadoc for the 
v2 implementation, although for v3 I believe it would tell you...

cheers,
-ml-


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org




Confidentiality Notice

The information contained in this electronic message and any attachments to this message are
intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information.
If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com
immediately
and destroy all copies of this message and any attachments.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message