Problems calling SharePoint Document Library upload form with custom button - sharepoint

I'm trying to create a link (not actually a button, but styled as a button) that calls up the Upload.aspx for a document library but I'm running into issues once Upload.aspx loads. The main issue is that the Cancel button is non-functional. I can upload select a file and upload it (and this works), but if I were to have accidentally clicked on the initial link and want to navigate away without uploading, the Cancel button doesn't make the page go away.
Now I haven't been able to have Upload.aspx display as a dialogue box over the list page--it gets called as a full page (even though I have "Open forms in dialog" enabled). I'm wondering if that's what the Cancel button expecting. Any ideas? The link that is being called is:
/mySite/_layouts/15/Upload.aspx?List=%7B4982C5B5%2DCF88%2D497F%2DA48D%2D815D7A355F0A%7D&Source=https%3A%2F%2FmyServer%2Ecom%2FmySite%2FmyDocLibrary%2FForms%2FAllItems%2Easpx&isdlg=1"

Turns out it was the &isdlg=1 at the end of the URL that was causing the Cancel button to not work. I removed this from the URL and it works properly now.

Related

How to follow a link that is actually a click button

I need to fill a form aproximately 100 times a day. I tried with selenium but it is quite slow because it is using a web browser. It's working quite well with mechanicalsoup until I need to click "Accept" button. Clicking it activates other tables that need to be filled but are inactive before clicking this button. I tried to point to the button and then br.follow_link(button) unsuccesfully. I attach the piece of HTML that I need to fake. I'm looking for a way to produce the effect of clicking avoiding using Selenium.
Aceptar
Sounds like you need JavaScript capability so the button's click would render the tables, but MechanicalSoup doesn't do Javascript.
MechanicalSoup's docs says:
MechanicalSoup automatically stores and sends cookies, follows redirects, and can follow links and submit forms. It doesn’t do Javascript.

How to cancel all downloads in Chrome extensions and avoid displaying Save As dialog?

I'm trying to cancel every download just as they are started.
Here's my code so far:
var downloadCreated = function (a) {
// cancel the download
chrome.downloads.cancel(a.id);
chrome.downloads.erase({id: a.id}, function (d) {
});
};
chrome.downloads.onCreated.addListener(downloadCreated);
I've set Chrome to display Save As dialog when downloads are about to start.
I run my extension and click on a link several times. Sometimes the download is simply cancelled (which is the exact behavior that I want), and sometimes the Save As dialog is displayed. Clicking on Save button in the dialog has no effect and nothing will be downloaded. Whether the dialog is shown or not is random.
I'm just trying to avoid displaying the Save As dialog by any means.
Do you guys know a solution for this?
I found the solution some time ago but forgot to provide the answer. Here it is:
To stop a Chrome download attempt, chrome.downloads.cancel should be called in the proper event, that is chrome.downloads.onDeterminingFilename. That's it! No useless save dialogs will appear.

How to make popUp not submit form on startup?

I am using JDeveloper 11.1.2.3.0,
I have a createInsert button that has ShowPopUp Behavior operation included. In the popUp I have inserted a form whose attributes will be clean from the createInsert operation. When I click the button the popUp shows up all right but showing an error about the mandatory fields of the form. The fields of the form of course are empty because I just opened it. So I think that the popUp is autoSubmiting the form at the starting point.
Does anyone have an idea how to stop it from doing this?
I have changed the createInsert button PartialSubmit property to false but nothing changed.
Ok found the solution. The popUp was not submitting anything actually but during the CreateInsert operation the iterator opens a new row in every related component within that page (form, table etc). So when my popUp opened up with the new form fields, a new row was being created in the back-stage in my read-only table. I changed the iterator in a new one from another Application Module for each case and everything is fine now.

Update view after using file upload

I am sure this is related to my question here
Null value for fileData:com.ibm.xsp.http.UploadedFile in dialog box?
Which I am still not 100% clear why the file upload control does not work directly in an extension pages dialog box.
But anyway I came up with my own solution using the file update control inside of a hidden panel. I need to set the button that uses the control to full update.
I have a button does an import of data. The button gets the file via a file upload control. This data is displayed in a view on the xpage.
The view is not being updated even though the Import button has Full Update. I am guessing that the full update actually get executed before the import actually completes?
Is there anyway to update my view after the import completes?
My understanding is that a File Upload requires a full refresh of the XPage to push the file up to the temporary folder on the server. At this point, the attachment is just stored in that temporary folder. It's not stored in the NSF. A subsequent function needs to be run to save that to a document.
Is your button doing the upload of the file to the temporary folder, or is it saving a Notes Document / directly accessing the temporary file and processing it via the back-end? If it's just performing the upload, the view won't upload.
The other thing I've come across is View Panels not immediately updating with new documents that have been created. In that scenario, a repeat control bound to NotesView.getDocumentsByKey() did immediately update.
I solved the issue by causing the button that uploads the file to display an extension pages dialog box. This dialog box has an OK button to close the message box but also refreshes the required part of the form.

jQuery Mobile - Dialogs without changing hash

I have a search dialog that I am popping up and filling with jquery templates. After they make a selection I set a value on the current page. As such I don't need hashTags or anything like that, I just need a pop-up dialog that I can open and close programatically. I am currently opening the dialog with
$.mobile.changePage(dialog, { transition: "slide", changeHash: false });
and closing it with
dialog.dialog('close');
However, in certain cases (when the page is navigated to), closing the dialog refreshes the current page.
Is there a better way to interact with this?
Update:
I think I figured out what is going on. So for some reason, jquery mobile usually keeps 2 pages loaded on the DOM - one of which is invisible, you can verify this by running $('[data-role=page]') in the console. One page is the page you're on, the other is the page that you initially navigated to. Not quite sure why they choose to do that, but there you have it.
So they treat dialogs as a page navigation with a different transition even if the dialog is already in the DOM. Therefore, if you go directly to the page and then trigger a dialog, modifying the current page and closing it works fine - because the original page is always loaded in the DOM. However if you go to another page, than navigate to the page that triggers the dialog, and THEN trigger the dialog it destroys the current page so that the pages in the DOM are the initial one and the dialog. In that case it reloads that dialog-launching page entirely and you never get a chance to make any modifications.
Jeez. How do I interact with the jqm dialog widget directly?
You can try two other things. Both should work:
1 set DomChache
How about overriding JQM to keep the page your are firing the dialog from in the DOM? The docs say you can set data-dom-chache and override cleaning the page from the DOM.
If it only happens when you load this page in via AJAX (vs. loading it directly) you could make DOM-keeping dependend on your trigger page having data-page-external, assign DOM-chache="true" only when the dialog is openend and remove it again once the dialog is closed.
2 override JQM
I had the same problem you described and got it to work like this (requires hacking into JQM though...):
// inside transitionPages function
if ( !$(toPage).jqmData('internal-page')
{fromPage.data( "page" )._trigger( "hide", null, { nextPage: toPage } );}
}
My problem was that pagechanging to certain pages (same as dialog) caused the preceding page (where the dialog fired from) to be removed from the DOM, so I had a blank screen (when trying to go back). I added data-internal-page="true" to the pages, which should keep the preceding page intact and added the if-clause in JQM.
So now pageHide (and DOMcleanup) only fires, if I'm not going to a page labelled with data-internal-page="true"
Cheers!
I think I was having a similar problem. What I wanted to do was based on certain parameters, pop a dialog window on load (with that content on the same page), which they can close and view the page that loaded.
I could get it to pop on load using load, or the pageshow events, but when I clicked close that sent you back to the previous page in history, instead of just closing the dialog.
//target your 1st page content, here its id=success
//the modal content is in a page id=dialog and data-role="dialog"
$('#success').live('pageshow',function(){
window.setTimeout(function(){
$.mobile.changePage('#dialog','pop',false,false);
},1);
}
Its a hack, and just allows the page load to beat the dialog so it gets stuck in history. Then the default dialog close behavior for the dialog works as expected. Talk about a PITA, if they took a little more for the JQuery UI dialog it would have made things a ton easier.
And regarding your question: Have you looked at Jquery Mobile Actionsheet plugin
If you don't really require a page to be loaded, that should be ok.
Also helpful could be Cagintranet iPad popover, although you have to tweak the design to be fullscreen on mobile devices. If you require CSS/Jquery to do that let me know (I'm using this in a JQM plugin I'm writing)
Hope that helps.

Resources