Is it working with custom forms ?

Jul 24, 2009 at 3:13 PM

Hi Paul,

i have a list with a custom form and can't get the solution working.

Does it also work with custom forms or only the ootb forms ?

Greets Marco

Aug 20, 2009 at 5:49 AM

Hi Marco,

I also cannot get the solution working with custom forms... did you find a way around this?

AutoSponge is there a way around this that you would be able to share?

Regards,

Andy

Coordinator
Aug 21, 2009 at 12:41 AM

The render methods are different for basically every type of control.  If you made a custom form and did not use the standard SP controls, you'd have to rewrite the entire script to match the new markup.  At the most basic level, the form fields need to have a title matching the key name used in the query string.

Aug 21, 2009 at 2:47 AM
Edited Aug 21, 2009 at 2:48 AM

Hi thanks for your reply, currently I'm trying to fill standard SP form fields within a custom form, the name matches the field, so for instance when I unhide the standard new form (ootb form) on the page the changes are reflected in the standard form (the code works well).

The only custom field on the page is the iLoveSharepoint custom picker field which has its own query string parameter collector http://www.codeplex.com/iLoveSharePoint/Release/ProjectReleases.aspx?ReleaseId=15633 which sets the field, this does not impact on ootb forms so cannot see it being an issue on the custom form...

I have tried using the xpath full name and the field's normal name in the query string with no success.

This is one of the fields (single line text field) I would like to fill, using 'Machine' in the query string should fill it, or am I missing a value in the tag itself?

<SharePoint:FormField runat="server" id="ff4{$Pos}" controlmode="New" fieldname="Machine" __designer:bind="{ddwrt:DataBind('i',concat('ff4',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Machine')}" />

Coordinator
Aug 21, 2009 at 1:03 PM

@andythomas,

spff is all client-side code.  So, you have to look at the rendered markup for the custom field.  In the spff code, there's basically a giant switch statement looking for key elements to determine which "job" to run.  Each job represents the process of putting a query string value into the appropriate form field(s).  So, if the rendered markup does not match a current job, you have to write a new one and give spff the logic to determine when that custom field is present.

Aug 21, 2009 at 3:41 PM

@AutoSponge,

My apologies if I'm still missing the point here, in this case the custom type field (custom picker) does not need to be prepopulated by the spff code as the custom field picks from the query string as apart of its own code. Also it doesn't seem to matter whether the field is present on the page or not.

The main issue is for the normal form fields, from looking at the rendered source of the form, the input title value for the single line text field 'Machine' is exactly the same as the property in the query string but there is no result when trying to pass values to the form. From the rendered source:

<input name="ctl00$PlaceHolderMain$g_0b75d9ab_60e3_484d_a9a7_64d0f70993fc$ff4_1$ctl00$ctl00$TextField" type="text" maxlength="255" id="ctl00_PlaceHolderMain_g_0b75d9ab_60e3_484d_a9a7_64d0f70993fc_ff4_1_ctl00_ctl00_TextField" title="Machine" class="ms-long" />

Coordinator
Aug 21, 2009 at 5:08 PM

@andythomas,

Since I can't see the custom form or the custom control, I'm only guessing at what it does and/or how it works. 

The markup you showed above should fit job10.  If it fires without that custom control but will not fire when you add the custom control, the problem is likely something in the JavaScript used by that custom control or some manipulation of the page that's been done by the customizing process.  For instance, if you hid the original form and added the custom form, spff probably only sees the first instance of the field using that title.

You will have to start using console.log in one or both scripts and/or setting some breakpoints to see what's happening.

 

Aug 26, 2009 at 5:46 PM
Edited Aug 26, 2009 at 5:56 PM

I also had the same problem when building a custom form. I used a "Custom List Form" which I believe is essentially a DataFormWebPart. Fields would not prepopulate.

I was able to find a fix by changing the following line of code in the spff.js file.

var f=$("[title='"+k+"']:input", "#part1"),

to

var f=$("[title='"+k+"']:input", ""),

After removing #part1 from that function call it appears to be working fine.

 

Sep 10, 2009 at 4:16 AM

Hi Rob,

Thanks for your suggestion however it didn't make a difference with our setup.

My workaround has been to code ASP form fields to replace the SharePoint Form fields on the custom forms and it works a treat.

Regards,

Andy

Feb 11, 2010 at 1:44 PM
rob04 wrote:

I also had the same problem when building a custom form. I used a "Custom List Form" which I believe is essentially a DataFormWebPart. Fields would not prepopulate.

I was able to find a fix by changing the following line of code in the spff.js file.

var f=$("[title='"+k+"']:input", "#part1"),

 

to

 

var f=$("[title='"+k+"']:input", ""),

 

After removing #part1 from that function call it appears to be working fine.

 

 

 

I just wanted to confirm that this workaround worked for me in the case of custom forms. However my form fields match the key name used in the query string, so this is a requirement for the workaround to work.

Sep 29, 2010 at 12:35 AM
andythomas wrote:

My workaround has been to code ASP form fields to replace the SharePoint Form fields on the custom forms and it works a treat.

Hi Andy,

Can you give an example of an ASP field replacement over that provided by the SharePoint:FormField controls included in the Custom List Form?

SharePoint must be doing something hinky at runtime which I simply don't get because all my input fields have exactly the same ID and name values in the rendered source!

Thanks in advance,

Paul

NB: I am I the only one who can't get Lock to work in Internet Explorer?? No probs in FF, Chrome etc.