Niclas,

it's the same as Simone described, but here is the example I used. I won't post the entire sample, but just a short version. I modified the inplace_edit example in the cforms block to test this.

In my flowscript I modified the do_inplace function (forms_flow_example.js), where the floscript function now looks like:

 form.showForm("inplace_edit-display-pipeline.jx");
 var buttonId = form.submitId;
 var widget = form.lookupWidget(buttonId);
 var attribute = widget.getAttribute("objectType");
 print(attribute);

In my form definition I have an OK button with an attribute objectType with the value 123.

 <fd:submit id="ok">
   <fd:label>OK</fd:label>
   <fd:attributes>
     <fd:attribute name="objectType" value="123"/>
   </fd:attributes>
 </fd:submit>

Then in my form template I defined the widget to be shown on the page.

  <ft:widget id="ok"/>

When pressing OK in my form, flowscript prints out '123' (the value of the objectType attribute).

What I meant with my previous email was that you showed us an example of one of your widgets.

[quote]

<fd:submit id="link-contributionDOT2">
  <fd:label>Datenbankkomprimierung</fd:label>
  <fd:attributes>
    <attribute name="objectType" value="link-contribution" />
    <attribute name="id" value="2" />
   ^^^^
  </fd:attributes>
</fd:submit>

[/quote]

If you look at it carefully, you will nottice I contains the fd: prefix for *attributes*, but not for an *attribute*.

That's why you get the null value back when requesting the attribute value.

I hope this helps.

Kind regards,

Jeroen Reijn



ZongoZongo wrote:
@Reijn: I am still not that familiar with cocoon. I would be kind, if you
could post the sourcecode, of how to fetch the value.

Thanks a lot

regards,

Niclas


Jeroen Reijn wrote:
Niclas,

now I understood what went wrong before.
Try fetching the value after putting the namespace in front the attribute:

<fd:submit id="link-contributionDOT2">
   <fd:label>Datenbankkomprimierung</fd:label>
   <fd:attributes>
     <fd:attribute name="objectType" value="link-contribution" />
     <fd:attribute name="id" value="2" />
   </fd:attributes>
</fd:submit>

Does this help? I tried it with cocoon 2.1.10 and it seems to work.

Kind regards,

Reijn


ZongoZongo wrote:
Yea, that sounds great. Sadly I get a null value forr the "var attribute"
:-(

Thats one of my widgets:

<fd:submit id="link-contributionDOT2">
      <fd:label>Datenbankkomprimierung</fd:label>
      <fd:attributes>
        <attribute name="objectType" value="link-contribution" />
        <attribute name="id" value="2" />
      </fd:attributes>
</fd:submit>

Why is this so difficult :-D

Niclas




Simone Gianni-2 wrote:
ZongoZongo wrote:
The Problem is, that the forms are generated dynamically. So i dont now
which
buttons eaven exists.
Hi Niclas,
you can write the following :

var buttonid = form.submitId;
var widget = form.lookupWidget(buttonid);
var attribute = widget.getAttribute("myattribute");

More or less .. :) I don' t have the code by hand, but that's the idea.

Simone


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