Vue.js Should you emit data from popup back to the main window? - vue.js

I and my co-workers can't seem to agree on what the best practice should be when it comes to Vue and popups.
The question is as follows:
You are on the main window, you get the data from the backend using REST API and you notice an error. To fix it, you go to an edit popup and after hitting save what should happen?
Should you call the API from the popup?
Emit the changed data and let the main window call the API?
...

This is very interesting question but I think the truth depends on your whole architecture, implementation and approaches you use.
Say, if you worry about the "separation of concern" you wouldn't give a popup any access to API because its work is to show you some data as a popup, return data, and that's it.
On the other hand, how are you handling errors? What if an error occurs when user works in popup? Where do you show error?
Another question is the usability. For example, if error occurs when you save data, if it's done by the main window, you are going to:
Show the error message
Make user to click some button again to show the popup
Fix a problem and click the Save button in it.
But if you would access API right from popup you would avoid first 2 steps. Another concern is how you handle wrong data.
If you are still in the popup you easily can validate the data and cancel saving (or disable this button at all) but if it's done after the popup is closed it may be too late.

Related

react-admin pristine state after loading data via dataprovider

I've got an issue due to a timing issue with react-admin, that i'm looking for a little help on.
The situation is where user A creates a resource, and user B, on a different PC, then goes to list and edit that resource.
For user B, the list page loads the full dataset of 10 resources, then the edit page re-loads the single resource that is being edited.
However, the specific process on the edit page seems to be:
Render page
Render resource cached from the list page
Request the single resource from the API
Populate the edit form with the updated values from the API
Set the form to dirty
That last point is critical, since I have an action button that is only enabled if the form is pristine, so the user has to save any changes before triggering the action.
But in this case, the list view and the edit view seem to return the same data for the resource, so I'm not sure why the form is being set to dirty.
Any thoughts?
Regards,
Andy
This isn't a complete answer, but I hope it helps you save some time. I recently upgraded React Admin version from 3.5.3 to 3.6.0. I noticed that the Save button is now sometimes disabled unexpectedly, and inconsistently. For example, I may navigate to the edit view of a resource by clicking a link and the Save button is enabled, but if I refresh the page, the Save button is disabled. Apparently, the Save button is supposed to be disabled when the form is pristine. So between 3.5.3 and 3.6.0, it seems that some changes were made to either the pristine handling or the Save button's reaction to pristine, and it is not working consistently.
I see there is a new issue opened three days ago regarding overriding the Save button behavior, wrt pristine. https://github.com/marmelab/react-admin/issues/4913 . So, it seems the dust hasn't settled on this behavior. Perhaps a bug will be found.

When calling a Lotusscript agent from a button on the web, how can I add a spinner so that until the agent is done the user knows it is processing?

I have a Lotusscript agent behind a submit button that takes a while to do everything....the user needs to know it is processing so that they do not click the button multiple times.
Am using #Command([RunAgent];"agentname") to kick the agent off.
How in Lotusscript could I add some kind of 'processing' indication, either a progress bar or a spinner or something? I suppose I could embed some javascript inside the lotusscript, but hoping someone has a clean example or some tips to do this.
Maybe hiding the submit button at the same time if I use javascript via a display property on a surrounding the button would help too.
You can't do this with LotusScript coding, and while hiding the Submit button is a good idea, you're going to have to know when to unhide it. A simple #Command([RunAgent]...) call won't give you a way to do that.
You're going to have to redesign your form to include a significant amount of JavaScript and make an AJAX-style call to invoke your agent asynchronously via a ?OpenAgent URL sent in a POST request via XMLHttpRequest. Your main JavaScript code will continue after the call and launch the spinner, and the callback that you set up to handle the asynch return from the XMLHttpRequest can then either transition to a new page or stop the spinner by setting a variable that the spinner is checking once every second or two.

Changing form name causes error message "Error accessing the system registry"

I am programming the On_Click method for the button labeled "View" in the first printscreen below. The method will load a form with data corresponding with the specific address id in the row containing the "View" button. This code worked perfectly when pointing to a target form called "Addresses". However, when I decided to rename the form "Address", I started receiving the following error message when clicking on the view button:
I did some research on the web about this error message, which lead me to try to delete any outdated references in the VBA editor. But when I clicked on Tools-->References in the VBA editor, I got the following error message:
It seems that MS Access' entries in the system registry might have been corrupted. But I am not certain of this because the documentation of this on the web is sparse and inconsistent.
Here is a link to the database on a file sharing site: http://jmp.sh/b/9Uyx6J2YzWbs8zPq2h6g
If the problem is in the database, you can recreate the problem by opening the form "Main" and clicking on the button "View" for the record shown in the printscreen above, or for other records.
Can anyone show me how to get past this error message?
my advices?
You could rename your Forms!....SourceObject to "Address" instead of "Addresses"
You could copy/paste the form, delete the original, and retry
You could install a decent debugging tool like MZ-Tools for VBA, that will help you manage your errors. Check the details here
EDIT: I used to get similar bugs years ago, when I was writing specific form event procedures. As we decided to switch to a model where forms did not need to be debbuged anymore (check this here), we stopped getting this kind of message. And I think I forgot the trick we used to solve this kind of error. If I were you:
I'd try to open another access database and import all objects ...
I'd put aside/cancel the faulty onClick procedure
And I'd install MZ Tools because otherwise VBA debugging is a nightmare ...
Since access was not liking the command button in each record of the continuous form, I choose to put the view button's logic in the on click event of a text box in each row, which I configured as enabled but locked. This produces a separate link from each record of the continuous form to a unique detail page with more of the chosen record's data.
This solution works perfectly, and is enabling me to move on with my other coding.
However, it would be nice if someone else were able to show how to get the command button solution to work.

Silverlight avoid requesting an event twice

I have a Control say for ex a Submit button if user clicks the button twice or more continuously then user receiving same message / same operation taking place twice or more.
I need to avoid this situation.
thanks for your inputs.
You need to detect the button click event either in the code behind of the view (or ViewModel if using the MVVM pattern) and disable the button. Now I take it that your submit button is firing off some kind of asynchronous operation. Once the asynchronous operation has successfully completed you will probably need to enable the button so that it is available again.
Shankar, if you want to avoid clicking on button, you should disable it. If you can give more details about what exactly you are trying to do, more details can be given.

ASP.NET Keep fileupload after postback

I'm writing an intranet ASP.NET page using VB.NET. I've run into a particularly nasty problem dealing with handling file uploads. I'll do my best to explain the problem, and perhaps someone can help.
My problem is almost a duplicate of this one, or this one, except (other than the filename) I don't care about sending the file to the server until the other data has been reviewed.
Here's the situation:
Joe Q. Dataentry inputs some data into several fields. The first 3 are drop down, and when he changes the selection, a postback event is fired that queries a database for valid entries for the other drop down selections. After selecting the values, he inputs some other data, chooses a file to accompany the data and clicks the "Update" button. When he hits the button, it fires a postback event that sends the current data to the server to be validated. The data will create a change in the database, so he is presented with a view of the current state, and what it will look like when his changes are made. He can now either confirm or cancel the operation for whatever reason.
Part of the data he will see involves the extension of the file which may be a PDF, or could also be some image file or other document.
Now here's where my problem is - on each postback event, the fileupload dialog is cleared. I was getting around it by creating a temporary file on the first postback and then renaming if he clicks OK or deleting on Cancel... but I need to do a variety of things, based on the previous state of data and the filename. I've tried to keep some session variables to retain the filename, and that works OK for just renaming the file, but for what I need to do it gets unwieldy.
What I want to do is be able to have the postback event to present the changes, and then when the user clicks "OK", submit the file. Is there any possible way to do that?
One of my thoughts was to do some of the validation client-side (I'm already re-validating server side so I'm not too worried about data security there), but I don't know how I could get the information from the database query.
Thanks for any help, and reading my slightly convoluted story/situation!
EDIT:
It appears that what I want to do is prevent a certain button from firing a full postback. Is there any way to do that?
EDIT II:
I have an update panel on the page already - is there any way for the button to only post what's in the update panel?
What you might want to do is place your drop-downs inside of an ASP.NET AJAX UpdatePanel, and keep your file upload control out of that.
Your update panel will do the post backs and allow your validation logic to happen without submitting the file, then when you hit your final "Save" button (which is also outside of your UpdatePanel) the entire form will be submitted back and you can work with your file then.