RE: Pre populate NewForm.aspx fields with values
- From: cm <cm@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 12 Mar 2007 13:32:10 -0700
Ok I managed to prepopulate using javascript. for a particular field you have
to browse to the page and get the crazy id for the <input> that is generated.
use that to reference the field.
I know of no other way atm.
I actually used this to generate an autonumber in a sharepoint list, this
has also been another lingering issue for some people.
Basically what i did:
-created an ID field in the list
-use XSL to get the ID of the last item in the list. Add 1 to it.
-Use javascript to pre-populate the sharepoint:formfield with the next ID,
and to disable the field from editing... Walla, a hacked autonumber :)
"cm" wrote:
I'm also curious if there is a solution to this..
Seems so far there is now way to set the value of a <Sharepoint:Formfield>
Item.
I've tried the Value attribute, the FieldValue attribute, and a few others.
All produce 'error rendering'.
Also doesnt seem javascript cannot be used on these pages.
"Vanessa" wrote:
Were you able to get an answer to this? I'm trying to basically prepopulate
the new form based on other fields in other lists and I'm having issuse
finding posts on how to do that in WSS2
"Hofmann, Frank" wrote:
Hi,
in WSSv2 the pre population of fields in a NewForm.aspx was done by a client
based JavaScript. Here is an example:
http://sharepointstudio.blogspot.com/2006/05/pre-populate-listfields-on-sharepoint.html
Is there a better way doing this with WSSv3? At least in SharePoint Designer
it is possible to define (query based) parameters for custom list forms. I
was able to display the value of a query string parameter using a easy
<xsl:value-of select="$Parameter"/> syntax.
And I even was able to display a preselected value of a connected lookup
field of the list. The following line displays the 3rd value of a lookup
field "customer" in a task list.
<SharePoint:FormField runat="server" id="ff10{$Pos}" ControlMode="Display"
FieldName="Customer"
__designer:bind="{ddwrt:DataBind('i',concat('ff10',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Customer')}"
ItemId="3"/>
But when I change the "ControlMode" parameter to "Edit" the "ItemId" is not
used to pre populate the lookup field with the 3rd value. And if I set the
"ControlMode" to "Display" in a NewForm.aspx the correct value of the lookup
field is displayed but not saved in a new record.
Is there a possibility to accomplish this task with some build in functions?
Or do I still need a fancy client based java script?
Thanks
Frank
- Follow-Ups:
- Re: Pre populate NewForm.aspx fields with values
- From: Jonathan
- Re: Pre populate NewForm.aspx fields with values
- Prev by Date: Dynamic Lists
- Next by Date: Search not working...help please!
- Previous by thread: Dynamic Lists
- Next by thread: Re: Pre populate NewForm.aspx fields with values
- Index(es):
Relevant Pages
|