AJAX Tabcontainer inside formview not inserting values - ajax

I have a TabContainer inside a data bound FormView (to present the information by category ex: Client Bio data, health history, financial details...). The Update and Insert of the formView doesn't work (posting NULL values to the database) - I guess the FormView cannot find the TextBoxes inside the tab container's tab panels.
Some of the forums say that it's because of the TabContainer's implementation (by design) of "INamingContainer", and a hack is to take control of the TabContainer's
source code (ajax ctl toolkit's source code) and remove the "INamingContainer" interface from it... Too complicated to my taste .. I'm kinda lost.
Well is there a straight forward and better way to fix this? I'm dazzled to see that the toolkit has failed to implement this basic functionnality as for most developper ordering info (tab control) with formview is a common need.
Thanks in advance,
Jeewai

Answering my own thread... I got some great inside from the asp.net forum and decided to post the solution here: Reproducing the explanation that helped me out:
Hope that will clear out some questions to other users who may encounter the same issue.
Best,
JY
Blockquote
Hi JY,
The short answer is that when a Bind statement is compiled, there are some limitations on extracting values for an insert/update. If the controls within the FormView are then within another Naming Container (TabContainer and TabPanel are both naming containers), then the compiler can't resolve how to extract the value from the TextBox. I have a more detailed discussion of this on my blog at http://www.aarongoldenthal.com/post/2009/03/15/ASPNET-Databinding-Bind()-Method-Dissected.aspx.
To get around this, you'll need to extract the values manually, something like:
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
// Get references to the controls
TextBox LastNameTextBox= FormView1.FindControl("TabContainer1").FindControl("TabPanel1").FindControl("LastNameTextBox") as TextBox;
// Set update parameters in datasource
ObjectDataSource1.UpdateParameters["LastName"].DefaultValue = LastNameTextBox.Text;
}
Since FindControl only searches the current naming container, you'll need to dig through each naming container (FormView, TabContainer, and TabPanel) to get to the TextBox.
Hope that helps.
Aaron
Blockquote

Related

How can I disable a custom toolbar button in CKEditor 5?

I implemented a version of the image insert Simple Plugin example from CKEditor 5's framework docs.
But the example doesn't cover how to disable the item when the editor's isReadOnly property is set (like it does by default for all the standard buttons). I found docs for an isEnabled prop as well as a bind method for ButtonView, but it quotes examples using a command item, rather than a view item. Problem is, the Simple Plugin example doesn't create a command to bind to.
So question is whether I need to create a command, or if there is some other way to make the view item's state sensitive to the readonly state of the editor instance.
Thanks, and my apologies if I've left out any needed context (new to posting here on SO). Feedback is welcome (and I know y'all will whip me into shape).
D'oh, I think I figured it out:
view.bind('isEnabled').to(editor, 'isReadOnly', isReadOnly => !isReadOnly);
Just needed to bind to the observable property of the editor. Seems to be working as I desired/expected.

Insert HTML using Writer.insert* functions in CKEditor 5

I see that Writer class has methods to insert Text. However, I fail to understand as to which of those methods is the right one to insert HTML into the editor.
Explanations
My case scenario is:
A User can create certain content template and save it. Later the user should be able to insert that same content into the editor and start modifying.
I'm handling this using the following code
activeCKE.model.change( writer => {
writer.insertElement( "text to insert", activeCKE.model.document.selection.getFirstPosition() );
activeCKE.setData(activeCKE.getData()); // to refresh the contents
}
It works well with "**text**" but not with " <strong>text</strong>". The latter appears as-is.
So my question is; What is the right way to insert the HTML string programatically that has already been created using something like the Writer class?
I see there is a concept of template in ui/template, however I'm unclear as how to convert editor.getData() to that template.
Please Note: I don't want to give the user an HTML editing interface. I just want to create templates to make his life easier. Hence my question has nothing to do with 'View Source Code' based questions.
While I continued my research post asking this question, I landed onto FAQs, where I got my answer.
const viewFragment = activeCKE.data.processor.toView( "<p>HTML Text</p>" );
const modelFragment = activeCKE.data.toModel( viewFragment );
activeCKE.model.insertContent( modelFragment, activeCKE.model.document.selection );
This satisfies my use case. However, I encourage the community to post other possible variations, such as using Template class. Especially because line-breaks due to any kind of tag (br, p etc) are filtered out.
Developers interested to show the source code & allow source code manipulation in CKEditor 5, can create a plugin that shows the contents of editor.getData() in a dialog (or something they like) and then reset the contents of editor and insert the content in a fashion similar to the one demonstrated above.

Stop Magento/tinyMCE forcing object tag type

So iv been reading about peoples problems with tiny MCE "messing up" code. I understand it isn't, but I have a very minor problem that is become a major problem.
Im trying to add a simple object tag to one of my CMS pages. I need the object type to be "text/html" but whenever I save the page it converts this to "application/x-shockwave-flash"
I don't want to turn off the tinyMCE cleanup option as by the sounds of things this is a really bad thing to do.
So is there a way to stop it changing just the type attribute?
I have tried adding the code to a CMS widget and adding the widget to the page but this get the same altered result.
This thread (Object tag is not working) seems similar, but simply changing the type isn't working for me as it is automatically changing back to flash upon save.
The url i am trying to load looks like this...
(http://www.domain.com/animations/embed/one/o-t-t-d?player_width=100%&player_height=100%) I have been told that this will return flash if it is available or html if not.
Im assuming that because i'm saving the page on a PC with flash available its recognising and changing the type.
Any help appreciated.
You can edit the file js/mage/adminhtml/wysiwyg/tiny_mce/setup.js to make this happen.
Look for the settings array (around line 100). Add 'extended_valid_elements' there, like this;
var settings = {
...
extended_valid_elements: 'object[type]',
...
};
This way, TinyMCE will know the type attribute is valid and won't change it.

Joomla 3 Article alternative layout

I've created an alternative layout for one of my articles which can be applied successfully, but as has been highlighted in various forums: if you view the article using the Single Article menu type the alternative layout doesn't get applied because of an XML override.
I have a Joomla site that is setup for Sales and Support where the article info such as date, hits etc is useful but on the marketing side none of that is needed, hence an alternative layout would work well.
I want to know how to enable my alternative layout using the Single Article menu type - I've already got the layout how I want it (testing it by having it overwrite default.php) but want to set it up as marketing.php instead and only have it applied to what is needed.
You're probably not going to like this answer because you have already written you're alternate view. If you were rewriting it to begin with, why would you not write in a way that the side bar parameters (date, hits, ect) are within a container that is only loaded conditionally. This way you would only have one view to worry about and a lot less headaches.

BEA Publisher Woes

I'm using BEA's Publisher product with ALUI. I want to have a simple portlet that just displays Content Items that I've published, but after playing with it for a couple of hours, I find myself stuck.
I have a Data Entry template that just takes a name and a file, and a presentation template associated with that. But I can't figure out how to make the presentation template display a list of published content items associated with the Data Entry template.
I tried using the Tag Helper and I saw that the file properties were available, e.g. name, location, length, however I can't get the template to actually display the information.
Also, since I can't publish said presentation template (you aren't allowed to publish a presentation template associated with a data entry template), I have to make ANOTHER presentation template, and include the first one, and then make a new portlet that displays that second template. Is this how it's supposed to work? It seems awfully complicated for such a simple task.
I would greatly appreciate any input anyone can give. Thanks!
In case anyone else runs into this:
http://forums.oracle.com/forums/thread.jspa?messageID=3171395&#3171395

Resources