Posts

Showing posts with the label custom control

SharePoint - Check File Name in Upload form in Document Library con Javascript

Image
Se si desidera controllare il nome del file di un nuovo documento in un Upload form, possiamo farlo con del buon Javascript ! Ho creato una funzione che controlla il nome del file e poi disattiva il bottone OK se la condizione non è verificata Ho eseguito un override della funzione CheckAssetLibMediaExtension sull'evento "onchange" del controllo input file nel file Upload.aspx. Se vediamo il codice HTML del file Upload.aspx (da browser), troviamo: <input name="ctl00$PlaceHolderMain$UploadDocumentSection$ctl05$InputFile" type="file" id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_InputFile" class="ms-fileinput ms-fullWidth" size="35" onfocus="ResetSpFormOnSubmitCalled();"  onchange="CheckAssetLibMediaExtension()"  title="Scegliere un file" /> Cercando la funzione, troviamo: function CheckAssetLibMediaExtension() { } Così, possiamo farne l'override! Creiamo...

SharePoint - Check File Name in Upload form in Document Library with Javascript

Image
If you want to check file name of new document in Upload form, you can do with Javascript! I created a custom js that check filename then disables button OK if condition is not verified. I override the function CheckAssetLibMediaExtension on event "onchange" of input file control in Upload.aspx. If you see HTML Source of Upload.aspx (rendered by browser) you see: <input name="ctl00$PlaceHolderMain$UploadDocumentSection$ctl05$InputFile" type="file" id="ctl00_PlaceHolderMain_UploadDocumentSection_ctl05_InputFile" class="ms-fileinput ms-fullWidth" size="35" onfocus="ResetSpFormOnSubmitCalled();" onchange="CheckAssetLibMediaExtension()" title="Scegliere un file" /> Search for function in HTML Source, you find: function CheckAssetLibMediaExtension() { } So, you can override it! Create in masterpage reference to jQuery and add function below : function CheckAssetLibMediaEx...