Comments on: JQuery for Everyone: Pre-populate Form Fields http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/ No GeekSpeak on SharePoint 2007 WSS and MOSS Mon, 27 Dec 2010 14:28:49 -0500 http://wordpress.org/?v=2.8.6 hourly 1 By: Sander http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-116397 Sander Thu, 09 Dec 2010 09:30:20 +0000 http://www.endusersharepoint.com/?p=1395#comment-116397 Thnx that did the trick! Turns out that you can pre-fill the TITLE column OOB! Thus without the need of this script?! Tested this on a customer site :-) Thnx that did the trick!
Turns out that you can pre-fill the TITLE column OOB! Thus without the need of this script?!
Tested this on a customer site :-)

]]>
By: Brendan http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-116279 Brendan Wed, 08 Dec 2010 18:34:06 +0000 http://www.endusersharepoint.com/?p=1395#comment-116279 Hey, This is probably because you are using the newer library for JQuery; I found that anything after like 1.3.2 didn't let lookup's work...try to make sure that it references 1.3.1 or 1.3.2 and not 1.4 anything and see if that makes a difference. Hey,
This is probably because you are using the newer library for JQuery; I found that anything after like 1.3.2 didn’t let lookup’s work…try to make sure that it references 1.3.1 or 1.3.2 and not 1.4 anything and see if that makes a difference.

]]>
By: sander http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-116191 sander Wed, 08 Dec 2010 09:36:10 +0000 http://www.endusersharepoint.com/?p=1395#comment-116191 Hi, Very Cool Thank you very much. Usin' the solution in 3 forms already. BUT(!!!!) I cannot get it to work with a LookUp?! One value of the lookup is "LookUp 1" Any ideas? I tried all these ../Demo/Lists/Child/NewForm.aspx?Editie=@1 ../Demo/Lists/Child/NewForm.aspx?Editie=LookUp1 ../Demo/Lists/Child/NewForm.aspx?Editie=LookUp%201 ../Demo/Lists/Child/NewForm.aspx?Editie=LookUp 1 THNX! Hi,
Very Cool Thank you very much. Usin’ the solution in 3 forms already.
BUT(!!!!)
I cannot get it to work with a LookUp?! One value of the lookup is “LookUp 1″
Any ideas?
I tried all these
../Demo/Lists/Child/NewForm.aspx?Editie=@1
../Demo/Lists/Child/NewForm.aspx?Editie=LookUp1
../Demo/Lists/Child/NewForm.aspx?Editie=LookUp%201
../Demo/Lists/Child/NewForm.aspx?Editie=LookUp 1

THNX!

]]>
By: Darko http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-114991 Darko Thu, 02 Dec 2010 19:31:05 +0000 http://www.endusersharepoint.com/?p=1395#comment-114991 Not sure why it does not work for me. I am trying to populate srid field with a number. Here is my URL: http://website/subsite/Lists/Feedback/Item/newifs.aspx?srid=10 I edited the newifs.aspx page, added CEWP to the page, uploaded my script.txt with your script above to sharepoint, linked to it in CEWP web part, and then tryed the url above which for some reason does not pre-populate my srid field. Any ideas? Am i missing something? Not sure why it does not work for me. I am trying to populate srid field with a number. Here is my URL:

http://website/subsite/Lists/Feedback/Item/newifs.aspx?srid=10

I edited the newifs.aspx page, added CEWP to the page, uploaded my script.txt with your script above to sharepoint, linked to it in CEWP web part, and then tryed the url above which for some reason does not pre-populate my srid field.

Any ideas? Am i missing something?

]]>
By: dave http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-114842 dave Wed, 01 Dec 2010 22:35:46 +0000 http://www.endusersharepoint.com/?p=1395#comment-114842 I have this working perfectly apart from where there is a single quote ' in the query string...for example &surname=O'Neil The query string simply stops after the ' character. The same happens with &...for example Title=John & Jane Books Any ideas? I have this working perfectly apart from where there is a single quote ‘ in the query string…for example &surname=O’Neil

The query string simply stops after the ‘ character.

The same happens with &…for example Title=John & Jane Books

Any ideas?

]]>
By: Paul http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-104631 Paul Mon, 11 Oct 2010 15:26:52 +0000 http://www.endusersharepoint.com/?p=1395#comment-104631 LEGEND LEGEND

]]>
By: John http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-102792 John Wed, 29 Sep 2010 20:11:53 +0000 http://www.endusersharepoint.com/?p=1395#comment-102792 Hi Eric, Am new to MOSS 2007, i have a requirement like " i have a survey with three fileds, ID/Number field, TItle field, Name. In a survey my requirement is when the ID field is selected , the remaining two fields have to be pre populated automatically from pulling hte information from other list. IS that possible with OOTB , am sure can't be. IF with Designer, in which form should i use the script and how do i do that. KInldy respond back soon on my email. Thanks a million in advance. Hi Eric,
Am new to MOSS 2007, i have a requirement like ” i have a survey with three fileds,
ID/Number field, TItle field, Name.

In a survey my requirement is when the ID field is selected , the remaining two fields have to be pre populated automatically from pulling hte information from other list.
IS that possible with OOTB , am sure can’t be. IF with Designer, in which form should i use the script and how do i do that.
KInldy respond back soon on my email. Thanks a million in advance.

]]>
By: jj_in_atlanta http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-96469 jj_in_atlanta Thu, 26 Aug 2010 14:17:42 +0000 http://www.endusersharepoint.com/?p=1395#comment-96469 I mis-spoke above - I was actually having a problem getting the code to populate a checkbox list. I was able to modify the code to detect that and populate it by adding the code below. It appears to work OK in IE and FireFox - no promises. ckBoxes=$(elm).find("span.ms-RadioText") if (ckBoxes.length>0){job=100}; //Checkbox List . . . case 100: //Checkbox List $.each(vals,function(i,e){ var V=alltrim(e); // the individual value $.each($(ckBoxes).find("label"),function(i,e){ if ($(e).text()==V) { $(e).prev().attr('checked',true);} }); }); break; I mis-spoke above – I was actually having a problem getting the code to populate a checkbox list.
I was able to modify the code to detect that and populate it by adding the code below. It appears to work OK in IE and FireFox – no promises.

ckBoxes=$(elm).find(”span.ms-RadioText”)
if (ckBoxes.length>0){job=100}; //Checkbox List
. . .
case 100: //Checkbox List
$.each(vals,function(i,e){
var V=alltrim(e); // the individual value
$.each($(ckBoxes).find(”label”),function(i,e){
if ($(e).text()==V) { $(e).prev().attr(’checked’,true);}
});
});
break;

]]>
By: jj_in_atlanta http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-96353 jj_in_atlanta Wed, 25 Aug 2010 20:00:47 +0000 http://www.endusersharepoint.com/?p=1395#comment-96353 I can't get this to work with a multi-select using MOSS 2007 - when I trace through the code it isn't able to determine what type of control it is. I can see that it gets to the section starting at line 50 of your listing above... but s1.length is always zero - any suggestions? i've been looking at it but can't figure out the issue. Thanks I can’t get this to work with a multi-select using MOSS 2007 – when I trace through the code it isn’t able to determine what type of control it is. I can see that it gets to the section starting at line 50 of your listing above… but s1.length is always zero –
any suggestions? i’ve been looking at it but can’t figure out the issue.

Thanks

]]>
By: Mark Scrimshire http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/comment-page-2/#comment-94160 Mark Scrimshire Fri, 13 Aug 2010 17:21:37 +0000 http://www.endusersharepoint.com/?p=1395#comment-94160 I would like to do something similar. I have a Content Editor Web Part that has code to suppress fields without having to pass all the fields to suppress via a URL Query String. Next I would like to be able to specify default values for some fields in a Content Editor Web Part. Looking at the code it seems like a case of replacing the Query String decomposition and replacing with a series of calls such as: prepop("Title", "Defaulted Title string"); Am I on the right track? I am not a javascript expert so I am at a loss as to how to modify your code to call from within the CEWP. Finally to bring all this together I would like to be able to use the Query String in a CEWP and wrap the field suppression code and the default value code inside an if or case/switch statement. This would allow one passed paramter to configure a series of fields in the form. The net result being .newform.aspx?IssueType=Escalation CEWP pseudo code then contains: /// Hide Fields _spBodyOnLoadFunctionNames.push("hideFields"); function findacontrol(FieldName) { var arr = document.getElementsByTagName("!"); // get all comments for (var i=0;i 0) { return arr[i]; } } } function hideFields() { /// use this format to suppress specific fields. /// var control = findacontrol("TrackingID"); /// control.parentNode.parentNode.style.display="none"; /// End of field suppression section } /// Here comes the customization section If QueryStringParam="Escalation" /// Suppress these fields var control = findacontrol("TrackingID"); control.parentNode.parentNode.style.display="none"; var control = findacontrol("Status"); control.parentNode.parentNode.style.display="none"; /// Set these default values prepop("Status","1-New"); EndIf If QueryStringParam="Issue" /// Suppress these fields var control = findacontrol("TrackingID"); control.parentNode.parentNode.style.display="none"; var control = findacontrol("Priority"); control.parentNode.parentNode.style.display="none"; var control = findacontrol("Severity"); control.parentNode.parentNode.style.display="none"; /// Set these default values prepop("Status","1-New"); prepop("Description","A short and sweet description); EndIf I would like to do something similar.

I have a Content Editor Web Part that has code to suppress fields without having to pass all the fields to suppress via a URL Query String.

Next I would like to be able to specify default values for some fields in a Content Editor Web Part.

Looking at the code it seems like a case of replacing the Query String decomposition and replacing with a series of calls such as:

prepop(”Title”, “Defaulted Title string”);

Am I on the right track? I am not a javascript expert so I am at a loss as to how to modify your code to call from within the CEWP.

Finally to bring all this together I would like to be able to use the Query String in a CEWP
and wrap the field suppression code and the default value code inside an if or case/switch statement. This would allow one passed paramter to configure a series of fields in the form.

The net result being

.newform.aspx?IssueType=Escalation

CEWP pseudo code then contains:

/// Hide Fields

_spBodyOnLoadFunctionNames.push(”hideFields”);

function findacontrol(FieldName) {

var arr = document.getElementsByTagName(”!”);
// get all comments
for (var i=0;i 0)
{ return arr[i]; }
}
}

function hideFields() {

/// use this format to suppress specific fields.

/// var control = findacontrol(”TrackingID”);
/// control.parentNode.parentNode.style.display=”none”;

/// End of field suppression section
}
/// Here comes the customization section

If QueryStringParam=”Escalation”

/// Suppress these fields
var control = findacontrol(”TrackingID”);
control.parentNode.parentNode.style.display=”none”;
var control = findacontrol(”Status”);
control.parentNode.parentNode.style.display=”none”;

/// Set these default values

prepop(”Status”,”1-New”);

EndIf

If QueryStringParam=”Issue”

/// Suppress these fields
var control = findacontrol(”TrackingID”);
control.parentNode.parentNode.style.display=”none”;
var control = findacontrol(”Priority”);
control.parentNode.parentNode.style.display=”none”;
var control = findacontrol(”Severity”);
control.parentNode.parentNode.style.display=”none”;

/// Set these default values

prepop(”Status”,”1-New”);
prepop(”Description”,”A short and sweet description);

EndIf

]]>