Warren Buckley suggested to change the output of the xslt macro to html which worked out.
Still it could be sweet if "normal" editors could paste in podio webforms into the RTE - so if anyone got a nice work-around for that i'm very interested :-)
Maybe you could consider creating a textbox multiple for this issue. You can put all the code you want into a textbox multiple without stripping anything. Could this be a solution?
Ahh, maybe I misunderstod what you where trying to do. Well, my first solution should actually still work, but if you've got the javascript in a macro, then you must use the RenderMacroContent extension to render the content of the richtext editor. Like this:
The best thing would be if the little bit of script code above could be pasted in whereever the user wanted it to be in the RTE. But I guess I could make a package where you put in the little bit of code and then it will make a macro, change the output to HTML and then it's possible to insert the macro wherever you need.
Can't you just contain the javascript snippet in a xslt file, and then insert that macro in the richtext editor? Then the user can choose where in the RTE they want to insert the script...
The problem is that it's not the same javascript file - so when the user creates a new web form it's a new snippet - but I think it's only the id of the form which changes - so there might be something there that could be "automated" somehow.
You could put a macro parameter (a textbox multiple type) on the macro that's inserted in the RTE, and that parameter should be used everytime a user inserts the macro. Then they can insert the snippet that they need whenever they inserts the macro.
In your XSLT file you can then grab the inserted snippet with somthing like this:
If it's only the id that changes isn't it then a matter of having a textfield where this id could be stored and the fetched in the proper place for the javascript in the XSLT file (or where you construct the script).
I'm trying to get to a proper solution - it seems that it's fine with a textbox or just a textfield for changing the id of the form - but have to dig a bit into how the generation of the form id's are created :-).
Thanks for your solutions guys and see you at CG11!
Could you say a couple of words on why you don't think the previous ideas are good solutions? Could be quite interesting to hear about :)
- Thanks
@Daniel:
If you have some spare time at Codegarden I think a small demo of your Umbraco/Podio stuff would be great. Just a small demo of 15 minutes or so in the sun over a beer :)
Podio form in Umbraco?
Anyone got an idea about why I can't get this to render?
<script src="https://podio.com/webforms/158807/4602.js"></script>
<script type="text/javascript">
_podioWebForm.render("4602")
</script>
It's a Podio webform such as this one: www.phases.dk/umbraco
Tried pasting it through the content editors HTML, putting it in as an macro but no luck.
Only way it works is to put it into the template directly but I don't want it to appear on all the pages that has this template..
Warren Buckley suggested to change the output of the xslt macro to html which worked out.
Still it could be sweet if "normal" editors could paste in podio webforms into the RTE - so if anyone got a nice work-around for that i'm very interested :-)
Hi Daniel
Maybe you could consider creating a textbox multiple for this issue. You can put all the code you want into a textbox multiple without stripping anything. Could this be a solution?
/Kim A
Ahh, maybe I misunderstod what you where trying to do. Well, my first solution should actually still work, but if you've got the javascript in a macro, then you must use the RenderMacroContent extension to render the content of the richtext editor. Like this:
Does that make sense?
/Kim A
Hey Kim
That could be a solution - just not the prettiest one - then I would have an extra textbox at all pages.
The "coolest" way could be if it could be pasted in the RTE - but I guess that's not really an option.
/Daniel
Hey again
The best thing would be if the little bit of script code above could be pasted in whereever the user wanted it to be in the RTE. But I guess I could make a package where you put in the little bit of code and then it will make a macro, change the output to HTML and then it's possible to insert the macro wherever you need.
Something like that...
Did you see my second reply Daniel?
/Kim A
Oops, sorry a bit to late there :)
Can't you just contain the javascript snippet in a xslt file, and then insert that macro in the richtext editor? Then the user can choose where in the RTE they want to insert the script...
/Kim A
:-)
The problem is that it's not the same javascript file - so when the user creates a new web form it's a new snippet - but I think it's only the id of the form which changes - so there might be something there that could be "automated" somehow.
You could put a macro parameter (a textbox multiple type) on the macro that's inserted in the RTE, and that parameter should be used everytime a user inserts the macro. Then they can insert the snippet that they need whenever they inserts the macro.
In your XSLT file you can then grab the inserted snippet with somthing like this:
/Kim A
Hi Daniel
If it's only the id that changes isn't it then a matter of having a textfield where this id could be stored and the fetched in the proper place for the javascript in the XSLT file (or where you construct the script).
/Jan
I'm trying to get to a proper solution - it seems that it's fine with a textbox or just a textfield for changing the id of the form - but have to dig a bit into how the generation of the form id's are created :-).
Thanks for your solutions guys and see you at CG11!
Great to hear Daniel.
And yes, see you at CG11! :)
/Kim A
Good to hear indeed.
Let's grab a beer a CG, huh? :-)
/Jan
I am not sure its a good solution.. but add your scripts in Dictionary and create a macro to GetDictionaryItem.. use the macro in RTE
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="dictionaryItem" select="/macro/dictionaryItem"/>
<xsl:template match="/">
<xsl:value-of select="umbraco.library:GetDictionaryItem($dictionaryItem)" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>
Podio is really interesting, really worth looking into...
I'll try your solution as well Anz.
Christer:
Yeah - sure is, if anyone want's to see some podio stuff @ CG11 just ping me :-)
Hi Anz
Could you say a couple of words on why you don't think the previous ideas are good solutions? Could be quite interesting to hear about :)
- Thanks
@Daniel:
If you have some spare time at Codegarden I think a small demo of your Umbraco/Podio stuff would be great. Just a small demo of 15 minutes or so in the sun over a beer :)
/Kim A
Hi Kim,
What I try to say is.. am not sure whether MY solution with dictionary variable is good for the current scenario :)
Anz
Ahh, makes sense then :)
Even though I'd love to hear if anyone finds the previous solutions bad solutions. Always want to learn new stuff :)
/Kim A
is working on a reply...