Modify images_upload_url dynamically on TinyMCE? - tinymce

I'm trying to pass a parameter on the URL provided in images_upload_url.
This parameter changes depending on a field on the page. (A date input)
Is there any way I can set the value of images_upload_url dynamically on TinyMCE?

Ok, so I ended up removing and initializing TinyMCE again.
function onChangeInput(){
tinymce.remove();
initEditor();
}
Not beautiful but it works just fine :)

Related

Symfony Form add just a Label

What is the way of add just label into a form and modify its value with the entity atribute value related to the form. PRE_SET_DATA event is properly executed but I don't know how to set its value. Picture code and result:
Cheers!
There is no way to just add a label (without textArea) dynamically, at least in Symfony 2.8 . I worked it around using an non-mapped disabled text without label.
You have to ADD again the same element name into PRE_SET_DATA function and 'thanks God Symfony' it keeps the order.
Cheers everyone!!

Is there a way to know from which a form is opened?

I work on Dynamics-crm 2016 version, I need to know from where a form is opened (grid, button etc) in ON-PREMISSE dynamics 2016, is it optional to get that data?
This can be solved in multiple ways. My simple suggestion: Add a boolean field on the form, set it default to false. Add some javascript that subscribes to the forms onLoad event. The logic changes the bool value to true. Thus when the form is loaded (opened), the JS code runs and sets the field to true. You can also timestamp it and set it to readonly.

How do I display a default value when no suggestion found in suggestbox

I would like to display a default value (that I already set using setDefaultSuggestionsFromText()) when there is no suggestion displayed for the user entered value. Thanks for your help!
You need a SuggestOracle that always returns a suggestion. You could easily build one that wraps your current SuggestOracle and returns your canned suggestion when the wrapped oracle returns none.

Disable escape in Zend Form Element Submit

I can't disable escaping in a Zend_Form_Element_Submit, so when the label has special characters it won't display it's value..
This is my actual Zend Form piece of code:
$this->submit = new Zend_Form_Element_Submit('submit');
$this->submit->setLabel('Iniciar Sesión');
$this->submit->setIgnore(true);
$this->addElement($this->submit);
I've tried $this->submit->getDecorator('Label')->setOption('escape', false); but I obtain an "non-object" error (maybe submit isn't using the "Label" Decorator)..
I've also tried as suggested $this->submit->setAttrib('escape', false); but no text will be shown either.. Any idea? Thanks
Should be as simple as doing this:
$element->addDecorator('Label', аrray('escape'=>false));
Or see setEscape(). http://framework.zend.com/manual/1.12/en/zend.form.standardDecorators.html
Regarding failure to retrieve named decorator... Try getDecorators() Do you see 'label' in the results?
There is no Label decorator for submit form element by default (this is why you get the error).
The $this->submit->setLabel('Iniciar Sesión'); value goes to Zend_View_Helper_FormSubmit, which always does escaping and uses the label as a value.
The helper used by the Submit element escapes by default. Unlike with the label decorator, submit labels are included in a HTML attribute so they need to be escaped.
Your label - Iniciar Sesión - is a perfectly valid UTF-8 string, so the escaped version of it will be the same. If your label is not appearing then something else is going wrong. I'd guess that your page is being served using a charset that doesn't match what Zend View is using (UTF-8 by default).
View the page source to see what actually gets output - that might give you some more clues. Alternatively if the page this form is on is public, if you can provide a URL we might be able to spot the issue.
I ran into a similar issue. In my instance, I added both a label and a description to a text field element. This line of code allowed me to turn off the html escaping for the description attached to that field element:
$form->getElement('txtUPC')->getDecorator('description')->setOption('escape', false);
In my testing, the setEscape() was not recognized by the form elements or their decorators.

ASP.NET MVC 2, Ajax.ActionLink resets form data

As I have an editor-list, that needs to have additional edit lines, I found this solution for the problem:
Mvc list editor by Stevens Anderson
this works perfectly, excepts that every time when I add a new line, the whole Form is set back to the default values. You can see the behavior in the demo of the linked page.
Try to edit the value of an input box and then add a new line without saving.
Why isn't it possible just to add a new editor line, without changing any data.
Ok, I've found a workaround
Instead of using the Html.AjaxLink I am now using a custom JavaScript function with jQuery
function newProjectExpenseRow() {
jQuery.get("/Controller/Action", function (response) {
$(response).insertBefore("#id");
});
}
it now gets the Control from the controller/action and inserts the result before the #id element