Can I use one form for add and edit List Items? - sharepoint

I created custom edit form and custom add form for my List. Both forms have the same FormFields and they differ only by ControlMode tag. In add form ControlMode="New" and in edit form: ControlMoe="Edit".
When I try use edit form as NewForm, in all input box I see text "... field value" insted of empty box. And when I try use add form as EditForm, all input boxes are empty insted of field value.
Can I somehow use one aspx file as newForm and EditForm at the same time to not duplicate aspx files?

For sharepoint webpart page(site page): No you can not have same form for both
For Sharepoint application page: yes you can. you have almost complete control over you application page.
For more info about difference in site page and application page:
http://akifkamalsyed.wordpress.com/2010/06/12/sharepoint-application-pages-vs-site-pages/
http://jwalin.wordpress.com/2008/05/26/difference-between-site-pages-and-application-pages/

Related

Add list of item in editor view page of orchard cms driver class

I try to create custom content part with following specification.
I need to add list of items in database with same editor template view page of driver.
I want to include one form with required fields with an add button, by using this add button I want to add more number of rows with given field values in database.
I have checked Orchard documentation in this link, they provide sample with single item add in editor template page. In my case I need to add multiple items in editor page.
In display view page of driver, I want to retrieve collection of data from database and rendered in display view page.
Please share some details for this.
Thanks,

How to build a webform with custom fields in drupal 7?

I want to build a custom webform using webform module in drupal 7 but I want to use custom fields as form fields. Is there a way to do it?
To create your custom field as per requirement follow this awesome link.
http://jamestombs.co.uk/2012-09-24/create-new-webform-element-drupal-7
Cheers!!!
You just have to create a new piece of Webform content by going to Content > Add Content > Webform. Once you make your title, body, etc, click "Save" and you'll be taken to the next step of creating your form fields (called "Components"). In the components area, you can add whatever type of field you'd like, and all the submitted data will be stored in the "Results" area for that piece of content.

Creating a ribbon custom button when inserting content to Sharepoing 2010

I want to create a button to popup a window and display a list that it's being requested to an external source. Then the user would click on one of the items to insert and iframe on the body of the post.
For this I think best way is to create a ribbon custom button right? How can I make it only appear when inserting content such as posts?
You need to create a custom action in your project. It's a small xml file that gets installed in the farm and dislays what ever you want. Check How to add a ribbon item using CustomAction in sharepoint 2010? for a sample and here for extended information on all the possibilities you have http://msdn.microsoft.com/en-us/library/bb802730.aspx

SharePoint:FormField in a custom webpart?

On my home page, I want a simple webpart that allow users to quickly fill an entry in a list.
The list have, let's say, three fields : title (text), body (rich text), category (lookup).
I don't want to use the standard DataFormWebPart because I have a bit of code-behind that also fill some technical hidden fields of my list (actually, I don't exclude the DataFormWebPart, but I didn't find how to use it with code behind).
So I started to implement a custom webpart. Because I don't want to have to handle manually each field input, I started to use the FormField control, which automatically choose the rendering control, and provide a Value property with the correct format :
<SharePoint:FormField runat="server" id="fldTitle" FieldName="Title" />
This code is not sufficient, I have to specified the listid :
<SharePoint:FormField runat="server" id="fldTitle" FieldName="Title" ListId="{title list guid}" />
This is working quite correctly. I can in code access the fldTitle.Value to retrieve the user input.
BUT I have to include the webpart in a properly packaged and deployed feature, that can be activated. The webpart will always target the same list, but as the list is also instanciated in the feature (ListInstance element), I can't know the Guid in advance.
I've tried using several technics to set the list ID on the fly, but without success.
I've also "reflectored" the SP dlls to notice FormComponent class are using a "Context" that is set by ListFormWebPart.
Finally, my questions are :
is it the correct way to create a custom input webpart on the home page (not a list custom form) ?
how can I keep the behavior of the FormField (choose the right control and handle the input and its conversion to the storage format) ?
Will I have to create a custom ListFormWebPart ?
May I play with ControlTemplates ?
thanks in advance for the help... I'm struggling with this simple case for days now...
I think that customizing form templates is the easiest way to customize list forms. Since custom form templates are implemented as user controls you can add whatever code you want.
See the following article:
http://www.codeproject.com/KB/sharepoint/SharePointListForms.aspx

View Page (DispForm.aspx) not associated properly for SharePoint list views

I've customized NewForm, EditForm and DispForm to allow users to create new, edit (with certain permission) and display service requests.
The forms work fine except in my views (e.g. Createbyme.aspx which shows all requests owned by me). Instead of pointing to my custom DispForm /[site]/Lists/[list_name]/DispForm_custom.aspx?ID=[request#], it links to /[site]/?ID=[request#].
Is there any suggestion for a fix?
I just answered this question in another post...
Restore NewForm.aspx file
To summarize,
Open the page and select the form control. Oen the propertis for that control and select the radio button "NEW ITEM FORM". After you save the page you can then select the page as a supporting file for the list and the setting will stick. Do not select the page as a supporting file first as the setting will not stick... ergo the order of your steps is important.

Resources