RE: Dynamic HTML Values and AJAX

2006-10-26 Thread Stewart, Gary


> -Original Message-
> From: Jason Johnston [mailto:[EMAIL PROTECTED]
> Sent: 26 October 2006 01:34
> To: users@cocoon.apache.org
> Subject: Re: Dynamic HTML Values and AJAX
> 
> You should be able to get the AJAX framework to update that 
> snippet of 
> code by wrapping it in a bu:replace element when it needs to 
> be updated. 
>   Anything that is wrapped in a bu:replace will be sent to 
> the browser 


Thanks, that worked a treat. Now that I know how to make the AJAX system do 
updates like that I might well play around with other things I can do :D. I 
shall look at that helper class soon though to make sure I'm not making 
needless updates on that output.

Thanks again your help it's been marvellous.

Gary

*
The information contained in this message may be confidential or 
legally privileged and is intended for the addressee only. If you 
have received this message in error or there are any problems 
please notify the originator immediately. The unauthorised use, 
disclosure, copying or alteration of this message is 
strictly forbidden.
*


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



Re: Dynamic HTML Values and AJAX

2006-10-25 Thread Jason Johnston

Stewart, Gary wrote:

Hi people,

I'm using CForms in Cocoon 2.1.8 and I've run into a bit of a problem
(I sort of posted about this a while back so a bit of this is a
repost). I was trying to feed some HTML into the form to provide
output to the user. To do this I use a pipe that generates XML output
and then I try and serialize that into the document using the JX
template stuff that looks like:

 

Unfortunately that doesn't dynamically regenerate when the op-list
value has changed (if anyone knows how to make it do that under AJAX
that would be the best solution by far).


You should be able to get the AJAX framework to update that snippet of 
code by wrapping it in a bu:replace element when it needs to be updated. 
 Anything that is wrapped in a bu:replace will be sent to the browser 
in the AJAX response and updated in the page.



  

value="${Packages.org.apache.cocoon.xml.StringXMLizable(xhtmlString)}"/>

  


  
http://apache.org/cocoon/browser-update/1.0";>
  ${xhtml}

  
  ${xhtml}


That's untested but should be along the lines of what you need.  Notice 
the  with the identical id attribute as the only child of 
bu:replace - this is the element that will be inserted into the page, 
and its id marks it as the target for future updates.


You'll also probably want to add logic to only add the bu:replace when 
the widget's value has been udpated.  Since you're already importing the 
CForms jx-macros file you'll have access to the 'cformsHelper' variable 
which is a helper class that has some tools for this sort of thing.


Hope that helps
--Jason




If I go for a straight up output then I just get the
Moo tags displayed. I looked at serialization on
the forms-field-styling.xsl, as XSLT 1.0, and therefore Xalan (AFAIK)
doesn't have a serialize function I looked at creating one that
looked something like this:


  
 function serialize(xmlString) { var
output = Packages.org.apache.cocoon.xml.StringXMLizable(xmlString); 
if(output == null) { output = "Oh Dear"; } return output; } 
 


but that just generated NULL values so I gave up on that.

I even wrote a stylesheet to convert the HTML into Text and just use
output but IE seems to ignore the line breaks on the  tag when
you insert it in dynamically (damn IE).

Any ideas on how to get the AJAX stuff to display this dynamically
when the value changes?

Thanks,

Gary


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



Dynamic HTML Values and AJAX

2006-10-25 Thread Stewart, Gary
Hi people,

I'm using CForms in Cocoon 2.1.8 and I've run into a bit of a problem (I sort 
of posted about this a while back so a bit of this is a repost). I was trying 
to feed some HTML into the form to provide output to the user. To do this I use 
a pipe that generates XML output and then I try and serialize that into the 
document using the JX template stuff that looks like:




Unfortunately that doesn't dynamically regenerate when the op-list value has 
changed (if anyone knows how to make it do that under AJAX that would be the 
best solution by far).

If I go for a straight up output then I just get the Moo tags 
displayed. I looked at serialization on the forms-field-styling.xsl, as XSLT 
1.0, and therefore Xalan (AFAIK) doesn't have a serialize function I looked at 
creating one that looked something like this:


  

  function serialize(xmlString)
  {
var output = Packages.org.apache.cocoon.xml.StringXMLizable(xmlString);
if(output == null)
{ output = "Oh Dear"; }
return output;
  }

  

but that just generated NULL values so I gave up on that.

I even wrote a stylesheet to convert the HTML into Text and just use output but 
IE seems to ignore the line breaks on the  tag when you insert it in 
dynamically (damn IE).

Any ideas on how to get the AJAX stuff to display this dynamically when the 
value changes?

Thanks,

Gary

*
The information contained in this message may be confidential or 
legally privileged and is intended for the addressee only. If you 
have received this message in error or there are any problems 
please notify the originator immediately. The unauthorised use, 
disclosure, copying or alteration of this message is 
strictly forbidden.
*


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