Gerdes

I created a customized edit form using the "Custom List Form" in SharePoint Designer. Now the attach file button no longer works. I am getting "This form was customized not working with attachment." Has anyone found a workaround for this

Re: SharePoint - Design and Customization Customized form not working with attachment

Hussein Taher

In the NewForm.aspx file locate the following:

<WebPartPagesBig SmileataFormWebPart runat="server" IsIncluded="True" FrameType="None" NoDefaultStyle="TRUE" ViewFlag="0" Title="Project Request (Production Team)" __markuptype="vsattributemarkup" __WebPartId="{42949044-3270-485B-9F55-304E0F66C99D}" id="g_42949044_3270_485b_9f55_304e0f66c99d" __AllowXSLTEditing="true" WebPart="true" Height="" Width="" partorder="1">

and add this tag directly after this tag:

<span id="part1">

<SharePoint:AttachmentsField ControlMode="new" FieldName="Attachments" runat="server" Visible="true"/>

find the following tag:

</WebPartPagesBig SmileataFormWebPart>

and before it add the following tag:

</span>

All the other unmodified forms should work, solution has not been tested on modified Edit or Display forms.





Re: SharePoint - Design and Customization Customized form not working with attachment

lchungue

Maybe have I made mistakes with my tests, but just adding id="part1" and AttachmentsField doesn't work.
I kept tweaking this solution and Evi's one to end up in a similar-in-appearance form, but which, even if the form show documents as being attached, simply creates the item without the attachment when validating the form. And there's no Javascript errors you'd have got with the above solution.

You can find another thread here

But if one day you get the solution, please share it with us Smile





Re: SharePoint - Design and Customization Customized form not working with attachment

Anonymous

What is the solution




Re: SharePoint - Design and Customization Customized form not working with attachment

Ludovic Chungue

There's probably none...





Re: SharePoint - Design and Customization Customized form not working with attachment

Anonymous

My attachments are saved now!

I was using custom form because i want to hide fields...

Since custom form not save attachments, i use the NewForm.aspx.

I order my fields : on the top are those i want to show (10 fields) and on the bottom those i want to hide.

I've found that in the newForm.aspx, the table in which fields are has no id and no name. But it's the only one whose className is "ms-formtable".

Here is my code:

Code Snippet

function count(){

var tables = document.getElementsByTagName('table');

var classe = null;
var tableCentrale = null;

for(var i=0; i < nb_tables; i++){
classe = tables[i].className;
if (classe == "ms-formtable"){
tableCentrale = tables[i];
}

}

var rows = tableCentrale.rows;
for(var i=10; i <rows.length-1; i++){
rows[i].style.display = "none";
}
}

(Sorry for my english!)




Re: SharePoint - Design and Customization Customized form not working with attachment

vincy_mala

Is there really no practical workaround for this problem Can you elaborate
a little more on the possible solution you propose





Re: SharePoint - Design and Customization Customized form not working with attachment

Anonymous

Here is my solution in details:

1) Order the colums (site library settings --> Column ordering).

Put the column to display in firt positions.

Count how many columns must be displayed (10 in my case)

2) Put this code in the NewForm.aspx (or EditForm and DispForm), in <script> tags and just after the line

' <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">'

Code Snippet

function count(){

var tables = document.getElementsByTagName('table');

var classe = null;
var tableCentrale = null;

for(var i=0; i < nb_tables; i++){
classe = tables[i].className;
if (classe == "ms-formtable"){
tableCentrale = tables[i];
}

}

var rows = tableCentrale.rows;
for(var i=10; i <rows.length-1; i++){
rows[i].style.display = "none";
}
}

3) Modfify the line <table cellpadding=0 cellspacing=0 id="onetIDListForm"> by <table cellpadding=0 cellspacing=0 id="onetIDListForm" onactivate="count()">

Now, the form display only the ten first columns because the javascript code hides the others.

Attachments works because it's not a customized form.





Re: SharePoint - Design and Customization Customized form not working with attachment

bmcmann

Can anyone explain the java script code here What does tableCentrale represent

thanks





Re: SharePoint - Design and Customization Customized form not working with attachment

Anonymous

"tableCentrale" is the table which contains the fields in the newform.aspx.

Fortunately, it's the only one which class is "ms-formtable".

// we get all the table in the NewForm.aspx

var tables = document.getElementsByTagName('table');

var classe = null;
var tableCentrale = null;

// we find which table has the "ms-formatble" class and we put it in the variable "tableCentrale"

for(var i=0; i < nb_tables; i++){
classe = tablesIdea.className;
if (classe == "ms-formtable"){
tableCentrale = tablesIdea;
}

}

we get all rows of the tableCentrale, and we display the only ten first
var rows = tableCentrale.rows;
for(var i=10; i <rows.length-1; i++){
rowsIdea.style.display = "none";
}





Re: SharePoint - Design and Customization Customized form not working with attachment

vincy_mala

Its not working





Re: SharePoint - Design and Customization Customized form not working with attachment

Anonymous

Sorry I forgot that:

var nb_tables = tables.length;

This solution works for me.





Re: SharePoint - Design and Customization Customized form not working with attachment

vincy_mala





Re: SharePoint - Design and Customization Customized form not working with attachment

bubblez

the javascript solution isnt any more than a hack, in my optionon. i want to hide fields for security reason and therefore js is the wrong way. what about modifying js when loading page can be done with firebug for example ...

looks like one has to build a custom control Sad