Usually when renaming a flux field, the old values are not transfered and have to be entered again. Is there a way to keep the values after renaming a flux field?
Let's look at this simple flux configuration for example:
<f:section name="Configuration">
<flux:form id="article" icon="{f:uri.resource(path: 'Icons/Content/Example.svg')}" options="{group: 'FCE'}">
<flux:field.text name="text" rows="1"/>
</flux:form>
</f:section>
If I now rename the field text to title all previously entered values for text are lost:
<f:section name="Configuration">
<flux:form id="article" icon="{f:uri.resource(path: 'Icons/Content/Example.svg')}" options="{group: 'FCE'}">
<flux:field.text name="title" rows="1"/>
</flux:form>
</f:section>
Is it possible to somehow let flux know, that the field title is supposed to have the values of the former field text?
Short answer: no.
If I now rename the field text to title all previously entered values for text are lost
Long answer: in fact, they are still present in stored XML from FlexForm, but with old name. There are two reasons for this:
This is not technically possible to determine, that the field was
renamed. Because the end result is same, as field was deleted and a new was created.
Imagine a situation, that you have two page templates, where first one contains field of name text and second - title. You set first template as page template and fill text with something. Then you change template to second one - should now title contain previously filled value? Then you switch back to the first template - should the text be restored (in fact it is restored, because Flux doesn't delete it)? And now combine it with inheritance of templates and see, which mess can happen.
Related
I'm using Tiny 4.9.10 to dynamically generate reports based on templates. Users can create templates which contain placeholders. These placeholders then get swapped out for their actual values when generating the actual report. The placeholders get their style (including font, which is the main issue here) from their enclosing <span>-tag.
When replacing the placeholder with their actual value, we use <br />-tags to insert new lines, since some of the placeholders are almost full reports on their own which need to be structured.
After the placeholders have all been replaced, we inject this dynamically generated content back into a Tiny editor, so as to allow users to make ad hoc changes to the content.
At this point however we noticed that the <span>-tag around a piece of generated content containing <br />-tags gets removed. This is a problem, because the style info that was enclosed in this tag gets removed as well, resulting in problems further down the line when generating a PDF.
What I've tried to work around this:
setting verify_html to false
adding +span[br]/+span[br /] to valid_children
setting forced_root_bloc to div
The first two options did nothing to help me, and while the last one looked promising, it didn't help, because even when using <div>, font info gets enclosed into a child <span>.
I know this is expected behavior, because <span> is an inline tag and so it shouldn't have <br /> tags as children, but I'm currently at a loss for a workaround which allows me to include <br /> tags into my dynamically generated content without losing the style (most importantly the font) of the parent tag.
So I solved this by replacing the <span> tags by <div> tags when we swap out the placeholders by using some regex looking for spans that enclose a <p>...<\p> or a <b />. This stops Tiny from throwing away the <span> tags when they contain either of these enclosed tags
TinyMCE considers the <span> <br /> </span> construct an empty space and deletes it in favor of optimization.
I may be late, but you can also try using this callback in the setup option to stop the editor from removing empty spans:
setup: function(editor) {
editor.on('PreInit', function() {
editor.schema.getElementRule('span').removeEmpty = false;
});
}
I used extension builder to set up my frist extension. Except for the translation and everything works very well.
You can bind an element to an language but not the other way round. What I would like to do is, to create all needed elements in the default language and then create translations based on (some) of these elements, like you do in Typo3 Web-View. It's important that there is some kind of connection/relation between the defaulr element and its translations to make a fallback to the default language possible.
Is this possible? Or do I need to create multiple fields for all element properties (for all langs expected so far) in each element?
Update/Solution
It seems as if the desired function is already implemented (just a bit hidden).
First you need to create a new Element in default language. Next you create a second new Element and save it as the desired language in which you need to extend the first Element. If you reopen the second one a new select field shows up, where you can choose the lang-parent. Save it again an you'll have the connection.
Do we talk about Fluid extensions?
If so you have a translation tool:
<f:translate key="list_nonewsfound" />
And to translate this u have to create a file in /Resources/Private/Language/locallang.xml
<T3locallang>
<meta type="array">
<type>database</type>
<description>Language labels for database tables/fields belonging to extension 'news'</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="list_nonewsfound">No news available.</label>
</languageKey>
<languageKey index="da" type="array">
<label index="list_nonewsfound">Ingen tilgængelige nyheder.</label>
</languageKey>
</data>
</T3locallang>
(Example taken from tx_news)
More information (german link): http://docs.typo3.org/typo3cms/ExtbaseGuide/Fluid/ViewHelper/Translate.html
(english link): http://wiki.typo3.org/Fluid#f:translate
I've successfully created a new Data List type in Alfresco, but was struggling to figure out what the tag is called to achieve a description under a field. I consulted the Data Dictionary, but was unable to find it.
It may not exist, but the this screenshot makes me hopeful. As you can see, the Modified Date field has the DD/MM/YYYY help text under it. This is exactly what I want to put under the Program Name field, but with my own string.
<property name="orpdl:programName">
<title>Program Name</title>
<type>d:text</type>
<helptext>What's this tag called?</helptext>
<mandatory>true</mandatory>
</property>
Eeuh that's just a div in the control field for all the date fields.
Take a look at alfresco/site-webscripts/org/alfresco/components/form/controls/date.ftl
The message you see is in this div:
<div class="format-info">
<span class="date-format">${msg("form.control.date-picker.display.date.format")}</span>
<#if showTime><span class="time-format<#if disabled>-disabled</#if>">${msg("form.control.date-picker.display.time.format")}</span></#if>
</div>
So you want a string, just create your own custom controller based on textfield.ftl and put whatever string you like. Probably best to do that by passing it through the control-params.
In the typo3 template I'm using the following line to get the last 5 added items from the backend and this works.
<f:cObject typoscriptObjectPath="lib.lastaddeditmes" />
Only the number of item I want to have it flexible and set in the fluid template. So for example like below where the qty is set to three, is this possible?
<f:cObject typoscriptObjectPath="lib.lastaddeditmes(3)" />
You can't do that in the view, instead you can make a copy of lib.lastaddeditmes in TypoScript and then use it in other place like:
lib.lastaddeditmesOnlyThree < lib.lastaddeditmes
lib.lastaddeditmesOnlyThree.someSetting.items = 3
and in view:
<f:cObject typoscriptObjectPath="lib.lastaddeditmesOnlyThree" />
Remember that TypoScript is just a configuration syntax (not programming language) so it shouldn't give you any huge performance drop.
im pretty new to jQuery, and i dont know how to do that, and if it can be done without editing manually the plugin.
Assume to have a simply form like that:
<form action="page.php" method="post">
Name: <input type="text" name="Your name" id="contact-name" value="" />
Email: <input type="text" name="Your email" id="contact-email" value="" />
</form>
When you submit it, both in 'standard' way or with ajaxSubmit(), the values of the request take the label of the field name, so in the page.php i'll have:
$_POST['Your name'];
$_POST['Your email'];
Instead i'll like to label the submitted values with the id of the field:
$_POST['contact-name'];
$_POST['contact-email'];
Is there a way to do that with jquery and the ajaxsubmit() plugin?
And, maybe, there is a way to do it even with the normal usage of a form?
p.s: yes, i know, i could set the name and id attributes of the field both as 'contact-name', but how does two attributes that contain the same value be usefull?
According to the HTML spec, the browser should submit the name attribute, which does not need to be unique across elements.
Some server-side languages, such as Rails and PHP, take multiple elements with certain identical names and serialize them into data structures. For instance:
<input type="text" name="address[]" />
<input type="text" name="address[]" />
If the user types in 1 Infinite Loop in the first box and Suite 45 in the second box, PHP and Rails will show ["1 Infinite Loop", "Suite 45"] as the contents of the address parameter.
This is all related to the name attribute. On the other hand, the id attribute is designed to uniquely represent an element on the page. It can be referenced using CSS using #myId and in raw JavaScript using document.getElementById. Because it is unique, looking it up in JavaScript is very fast. In practice, you would use jQuery or another library, which would hide these details from you.
It is reasonably common for people to use the same attribute value for id and name, but the only one you need to care about for form submission is name. The jQuery Form Plugin emulates browser behavior extremely closely, so the same would apply to ajaxSubmit.
It's the way forms work in HTML.
Besides, Id's won't work for checkboxes and radio buttons, because you'll probably have several controls with the same name (but a different value), while an HTML element's id attribute has to be unique in your document.
If you really wanted, you could create a preprocessor javascript function that sets every form element's name to the id value, but that wouldn't be very smart IMHO.
var name = $("#contact-name").val();
var email = $("#contact-email").val();
$.post("page.php", { contact-name: name, contact-email: email } );
This will let you post the form with custom attributes.