Populate SPFieldMultiChoice from URL with poplateFromQuerystring.js

Aug 24, 2011 at 9:15 PM

I am using the JPart.poplateFromQuerystring.js script to allow for values that are transmitted in the URL string to be pre-populated in a new form. This works very well for straightforward text box fields. For example, if I have a text box field called "Title" and I include the string "Title="test"" after the ? in the url, the Title field will be pre-populated with the value of "test." Awesome.

But it all falls apart when I want to, say, have a checkbox marked for a field in which multiple items can be selected.

When I look at the code, I can see that this type of field is called SPFieldMultiChoice and that each of the individual checkboxes is called out in an array after the field name on the page.


<!-- FieldName="Tags"
			<span dir="none"><table cellpadding="0" cellspacing="1">
						<td><span class="ms-RadioText" title="Test 1"><input id="ctl00_m_g_de8297cf_ef20_45d3_b253_d8f3f8c8e009_ctl00_ctl05_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00" type="checkbox" name="ctl00$m$g_de8297cf_ef20_45d3_b253_d8f3f8c8e009$ctl00$ctl05$ctl02$ctl00$ctl00$ctl04$ctl00$ctl00" /><label for="ctl00_m_g_de8297cf_ef20_45d3_b253_d8f3f8c8e009_ctl00_ctl05_ctl02_ctl00_ctl00_ctl04_ctl00_ctl00">ABC</label></span></td>
						<td><span class="ms-RadioText" title="Test 2"><input id="ctl00_m_g_de8297cf_ef20_45d3_b253_d8f3f8c8e009_ctl00_ctl05_ctl02_ctl00_ctl00_ctl04_ctl00_ctl01" type="checkbox" name="ctl00$m$g_de8297cf_ef20_45d3_b253_d8f3f8c8e009$ctl00$ctl05$ctl02$ctl00$ctl00$ctl04$ctl00$ctl01" /><label for="ctl00_m_g_de8297cf_ef20_45d3_b253_d8f3f8c8e009_ctl00_ctl05_ctl02_ctl00_ctl00_ctl04_ctl00_ctl01">Acc Test Driven Dev</label></span></td>

So I can gather that I somehow need to include either the title or the input id or some other identifier for the individual checkbox that I want to have checked and then indicate a value of "checked" afterwards, but I'm not sure what syntax to use when setting up the URLstring. I've searched StackOverflow and other resources and haven't seen this question posted.

Any help?

ALSO - the username and password for the sharejpoint site appear to be broken.