Skip to main content

The Human Services Professionals

Go Search
Home
Our Products
Frontline Apps
About Us
Contact Us
Our Rates
  
> Resources > The Human Services Professionals > FAQs and User Manuals > Custom Forms for Lists  

Custom Forms for Lists

 
Create a custom form in addition to the existing form
To create a variation on an existing NewForm or EditForm, which allows you to remove some fields, or add code to buttons, such as redirection code, and still have the main form available with all questions
  1. Open your site in SharePoint Designer.
  2. Browse to your list and open the 'NewForm.aspx' web form.
  3. Go File > Save As... and give the form a new name such as 'NewForm2.aspx'.
  4. Delete the default List Form Web Part from the page.
  5. Go Insert > SharePoint Controls > Custom List Form.
  6. In the List or Document Library Form dialog, select the appropriate list, content type and type of form.
  7. Click OK and a new Data Form Web Part is added with controls representing all the fields from the list (in my environment all the controls show "Error Rendering Control" but this does not affect the final result).
  8. In the newly added Data Form Web Part, delete the rows containing fields not to be shown to the user (ensure that fields being removed are not required fields without default values as this would prevent the user from submitting the form).
  9. At this point, you can do other customisation such as rearranging the fields if you wish.
  10. Save the site.

to modify button code, replace entire buttons with something like this for the top buttons:

Red Code is changed

<tr>
<td class="ms-toolbar" nowrap="">
<table>
<tr>
<td width="99%" class="ms-toolbar" nowrap=""><IMG SRC="/_layouts/images/blank.gif" width="1" height="18"/></td>
<td class="ms-toolbar" nowrap="">
<input type="button" value="Save" name="btnSave1" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={http://resistatementhelp.rostercoster.com}')}" /> </td>
<td class="ms-separator"> </td>
<td class="ms-toolbar" nowrap="" align="right">
<input type="button" value="Cancel" name="btnCancel1" onclick="javascript: {ddwrt:GenFireServerEvent('__cancel;__redirect={http://resistatementhelp.rostercoster.com}')}" /> </td>
</tr>
</table>
</td>
</tr>

and this for the bottom buttons:

<tr>
<td class="ms-toolbar" nowrap="">
<table>
<tr>
<td width="99%" class="ms-toolbar" nowrap=""><IMG SRC="/_layouts/images/blank.gif" width="1" height="18"/></td>
<td class="ms-toolbar" nowrap="">
<input type="button" value="Save" name="btnSave2" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={http://resistatementhelp.rostercoster.com}')}" /> </td>
<td class="ms-separator"> </td>
<td class="ms-toolbar" nowrap="" align="right">
<input type="button" value="Cancel" name="btnCancel2" onclick="javascript: {ddwrt:GenFireServerEvent('__cancel;__redirect={http://resistatementhelp.rostercoster.com}')}" />
</td>
</tr>
</table>
</td>
</tr>

Last modified at 18/03/2012 16:00  by Tony Ryan