SharePoint 2010 and Editform.aspx - sharepoint-2010

In one of my custom application user wants to keep EditForm.aspx open once list item is created and he can keep saving the same record without redirecting user to DisplayForm.aspx page.So what I'm doing after list item creation I'm loading EditForm.aspx again.
Now the problem is when form is opened in Edit mode and if existing field is modified that doesn't gets updated in the list item but if something new added to the field then it gets saved to the list. I believe it's postback issue but not sure how to pass latest form data upon save.

If this was my task, I would create a new application page that replaces the edit page on that list.
(You can use powershell / object model to set the url of the new / edit / display pages)
Ignoring the ribbon, the edit page is actually pretty simple. It shouldn't be too difficult to create a custom one, that has the submittal behavior you are interested in. Indeed, since you are keeping the exact same field names and input types, you may be able to simply inherit the default form in yours, and simply override the post call.
I suppose it might be possible instead for you to write some javascript to hijack the submit post of the default edit page, but this seems messy to me, and I probably wouldn't go that route.
If you don't need to complete this task today, I've been meaning to push to github some code I wrote a few months ago. That code is a custom aspx edit/new/display page that is extremely easy to customize / implement. I could forward you the link tonight when I get out of work.

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.

Using querySaveDocument to additional information

We are trying to save some additional information with a document using the QuerySaveDocument event. However it seems that it is not being triggered at all.
<xp:executeScript script="#{javascript:setField(document1, 'cCustAddr1_fi', 'test');}">
</xp:executeScript>
This is our basic script. All the setField() method does is use replaceItemValue to try and set the field. However it seems that QuerySaveDocument is not even being triggered since we can write pretty much anything and the document will still save without problem, even if it would be impossible to execute.
We have also tried using a simple document1.getDocument().replaceItemValue() script, but again I dont think it even attempts to execute. Our documents save perfectly fine too,
Do you see any reason for this, are we doing our saving wrong, or should we be attaching data onto the document in another way?
Thanks.
Your other question on Unplugged (Using other dialog controls in iOS) suggests that you are using the Unplugged Mobile Controls project.
If that is correct then my comment above applies - the querySaveDocument event won't get fired . You can look at the code in UnpSaveDocument.xsp and possibly add your own SSJS code to that.
Alternatively, if you want an additional item created on your back-end Notes document then you should just be able to add a hidden field to the UnpFormEditor that is bound to the document1 data source and using the relevant item name you want.

Setting up recycle bin functionality in Archer GRC

When deleting records within the platform, this action is not reversible via the front end. Is there a way to allow users to remove a record from their view without actually deleting the record?
You can simulate recycle bin functionality within Archer GRC by adding a record permission field that grants read access to "Everyone". If read access is no longer required then an editor of the record can go in and change "Everyone" to a group called "Recycle Bin."
Please note that if there are other record permission fields in the application, users or groups may still have access if they are selected in those fields. Perhaps You can set up a dropdown status field for the user to select "Recycle Bin" and use this condition for automatic record permissions to revoke permission to the record depending on the requirements or workflow of the application.
Solution shared by Igritte might be somewhat confusing for end users.
End user will see greyed out "Delete" button in the top toolbar, but he has to select "Recycle Bin" in the form. This solution was not accepted by my business owner at some point.
As a work around for "Soft delete", I wrote a custom object overriding "Delete" button functionality.
1. User doesn't have delete access to the record, so JavaScript code will make "Delete" button look like active and available.
2. Once the button is clicked, custom object will populate value in the
hidden value list and simulate the click on the "Save" button.
Update: Note that Custom object needs to hide the value list first once the page is loaded. Here you will need to use a JavaScript and do the following: [a] locate the value list DOM object and [b] set display attribute to none. I used jQuery library to do both. This way your value list is not displayed, but you still can use it to control data driven events.
3. With hidden value populated and submitted, record permission will hide this record from the end user.
Note that custom object hides one value list on the layout as well.
If for some reason JavaScript doesn't load properly, user simply will not be able to click on the grayed out "Delete" button.
Update: Hidden value list can be populated by custom object using JavaScript code as well. You need to identify the form tag "input" in HTML code of the page and set attribute "value" to the desired state. I used jQuery library to do this as well.
I have this solution in production working fine with IE11, FF and Chrome.
I can't share the code, but with WC3Schools JavaScript guides and 4 hours you can write and test it yourself with very little JavaScript skills.
Sometimes you have to use custom objects when you want to get a user-friendly solution of not available functionality.
Good luck!

How to come back to form without reset the values?

I have a web application that is made with Java+Struts.
There is a form that when is submited it executes an Action that shows the results of the search.
Since here, all ok.
What I need is to put a link in the results page to come back to the form without erasing the search parameters.
I've put a link that goes back to the form page, but allways erase the search parameters.
I've thinking about saving and restoring this parameters to the java session, or adding the parameters to the url (like: /myForm?param1=1&param2=2&param3=3) but I think that maybe there is a better way to do this.
There is any way to do this with struts?
Pd. The struts version is 1.3.8
Just add the parameters (/myForm?param1=1&param2=2&param3=3) to the button url that leads back to the search form. Then populate the fields using the parameters. No need to use session variables.
Unless i'm missing something...

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.