Retrieve CKEDITOR5 data after going back - ckeditor

Is there a way to get CKEDITOR 5 data back in the fields when we hit the back button? Let me explain : I have a page where there is a form (containing my CKEDITOR fields) and when I submit this form, I'm getting my page rendered with all these informations I previously written. But if I do a mistake and want to go back, all my textareas from CKEDITOR are blank.
Also, It used to be different with CKEDITOR 4 where it retrieved my data when I was going back.
I've tried to enable autosave, to enable updateSourceElementOnDestroy in my default config

Related

Joomla modal popup target url does not get session value

I have a problem regarding modal popup and session.
I have two component name test and test1 respectively.
In test there is a form in view in which i put "Anchor" tag with "modal" class. has also class name "class1".
When i clicked on Anchor tag it call click function(on click "class1") in which i put ajax code for set data using "Session".
$('.test').click(function(){
// Ajax code here for set data using session
});
with above function it also called modal popup. here targer url is seted which is the view of 2nd component which is "test1".
Here in test1 there is a view.html , we are getting session data here and displaying in view.
PROBLEM
Problem is that , here in 2nd component , in view i am getting session data but i need to click on button two time , only after i getting data properly.
When i click on it give me a old session data. and when i click on it second time it will give me a proper data.
What is the solution for above problem. if anyone know please let me know.
Session data is altered only after we click on Anchor tag.
Both thing is done on Anchor click , one is for set data in session and second is for modal popup. in popup i am getting data which set in session.
when is the session data is being altered?
Is it altered by ajax call too?
In this case, javascript, is unsynchronous. It doesn't wait for something to happen in order to fire the next line of code. In that case there are several techniques you may find to do so.

Combining Radgrid, RadajaxPanel, ValidationSummary and a custom "turn field in error to red" issue

Here's the format of a sample page :
*Validation Summary*
Label : [input]
Label : [input]
###############
# RadGrid #
###############
###############
# RadGrid #
###############
Label : [input]
[save button]
1st version :
When I push the save button, the whole page reloads. The validation summary is filled with errors (or not) and the input that are in error are shown in red.
When I open a RadGrid (custom edit template), the whole page reloads and the save button is desactivated.
Problem : The whole page is reloaded when we open a grid and it's uhh... not what the customer wants...?
2nd version :
We have put radAjaxPanel around the radgrids, so when you open a grid, only the grid reloads. Problem : The save button is not desactivated anymore.
If I click the save button, the whole page still reloads.
3rd version :
We added a radAjaxPanel to the save button and a line (see footnote) to reload this radAjaxPanel when a RadGrid is opened or closed
Now the button is activated/desactivated properly.
Problem : When I push the save button, only the button reloads and if there are error on some fields, they are not turned to red. The validation summary still work.
4th version :
Added a line (foot note) to reload the whole page when the save button is pushed.
now the field in error are turned to red
Problem : this extra postback make the validation summary dissapear.
So, any ideas on how could I have all these options working together?
The easy way out would be to convince the customer to abandon radAjaxPanel (because I feel we use them incorrectly anyway and it brings little advantages).
The whole project architecture is somewhat complex (we emulate .net mvc with webforms (!)) and I feel like code would just add cluttering to the questions, but if you think some specific parts would need more details/code, feel free to ask.
MainRadAjaxPanel.ResponseScripts.Add(string.Format("$find('{0}').ajaxRequest();", MainRadAjaxPanel.ClientID));
I recommend using the RadAjaxManager control instead of several RadAjaxPanels. The RadAjaxManager allows more flexibility around what item(s) are triggered by what control(s). Unfortunately I can't give specific example with the information above but hopefully this will get you pointed in the right direction. You can definitely do what you're wanting with the RadAjaxManager and get everything working. Just be mindful of AJAX triggers and updates, i.e., what control triggers an AJAX update (e.g. your save button) and what receives the corresponding update (your ValidationSummary).
http://www.telerik.com/help/aspnet-ajax/ajax-ajaxmanager.html

It's possible to pre save the knockoutjs view model to prevent refresh and data lost?

i have a MVC3 project with KnockoutJS and in my view.
The form that the user fills, has information already loaded from the server and the user is filling and selecting from this data so then, the user saves the data selected.
So... sometimes, the user, in the middle of the form, realize that some data is missing and it must cancel the form fill and edit the data that is missing and come back and do it again. So, my question is this... can i persist the view model in some way that the user can edit the missing data in other tab or window in the explorer and then refresh the form and dont lose the data?
I hope the explanation was clear.. my English is a little bit rusty.
Thanks!
Yes, you can. If the data is on the same page, you could save the viewmodel data to another object, possibly using ko.toJSON. Then you can pull it back in later.
If you have to reload the page, you could save the viewmodel or the form's state in storage, using a library like amplify.js. http://amplifyjs.com/api/store/
pseudo code:
amplify.store('myData', myViewModel);

Joomla 2.5 How can I abort a save operation if there's an error?

Is it possible to abort a save operation in a Joomla controller? (Admin Side)
For example:
I have a view with a list of items. I hit the New Item button and in the next page I enter all required fields and hit save. My form also has a file upload field for uploading a small image. That image has to be 25 by 25 pixels or else the new item won't be saved.
The only way I found so far to abort the save operation (if an error like the image size is found) is to call the cancel() method parent::cancel(); in the controller. This takes the user back to the list of items. I need to know if there's another method that will reload the new item form view with all the fields filled from the previous post so the user can just select a correct image and re-post the form without the need to fill all the fields from scratch.
Currently I'm fine with the cancel() method and if the user hits the browser's back button he will probably get back to the form with all the fields loaded, but I was just wondering if there is a way to reload the form.
I don't think there is a way to accomplish this without doing a lot of coding and hacking. Have you considered trying to gauge the size of the image using JavaScript before the image is uploaded? Or allowing people to save the normal data first and then ask for the image?

HTTP POST and graceful degradation

I have a web application which among other things contains a table of items created using an Ajax callback. A bunch of form fields at the top of the table allow me to filter the items that will be displayed in the table according to various criteria and show it.
Some parts of the table have lists of items with an [X] marked next to them that I can delete by clicking on those items.
Now, if I were doing this the non-ajax/javascript way, the page would receive a bunch of POSTed data fields and then would render the table accordingly. I can do this but I would also like to Ajaxify the entire setup. My questions are regarding this.
How would I create the [X] button. A simple <a> would "work" but it's a GET modifying state so I don't want to do that. The way I'm doing it now is a tiny form with a hidden parameter than holds the item to be deleted and a styled submit button that's the [x]. If I ajaxify this, I can get the response and do the needful.
How do I keep my backend DRY? I don't want to have two completely different bits of code for the Ajaxified version and the regular ones. What I'm doing right now is having the non-ajax version submit to a URL that changes the state and then redirects to the main page again (similar to a PRG type system). With the Ajax enabled, I simply call the URL and ignore the redirect but use the returned data to adjust the table. Is this the "right way"?
Any other advice on graceful degradation on how to keep my backend DRY?
I would put each row into it's own form (with method='POST'), and include a hidden field to say which item is to be deleted. The [X] would submit the form, and in the form's submit event, if no XmlHttpRequest is present simply submit the form to the server which would delete the item and redirect to the same page again (this is good practise to avoid a reload from resubmitting the delete POST).
If an XmlHttpRequest is present, set it up to POST with the id of the thing to delete and then remove the row if the request succeeded. You could set a flag in the AJAX request so that redirect doesn't happen, just a success (200 OK).

Resources