tag:help-archives.hannonhill.com,2010-02-09:/discussions/web-services/1663-multi-selectCascade CMS: Discussion 2016-08-24T19:20:51Ztag:help-archives.hannonhill.com,2010-02-09:Comment/405895192016-08-22T21:53:12Z2016-08-22T21:53:13ZMulti-select<div><p>How would I set multiple values for a multi-select? The value
I'm entering into the dynamicField 'healthsciences' is actual an
array from a multi-select input $user_data['healthsciences'].</p>
<p>$data = array( 'name' => $name, 'parentFolderId' =>
'9e92f2100a92bba37b7a93f0b0424729', 'metadataSetPath' => '/In
the news', //'parentFolderId' => $folderId, 'linkURL' =>
$user_data['link'], 'siteId' =>
'3b6fddc09b64773a0091cdb1407b7f34', 'shouldBePublished' => true,
'shouldBeIndexed' => false, 'metadata' => array( 'title'
=> $user_data['title'], 'keywords' => '', 'endDate' =>
$startDate, 'startDate' => $startDate, 'summary' =>
$user_data['summary'], 'dynamicFields' => array( 'dynamicField'
=> array( array('name' => 'newspaper', 'fieldValues' =>
array('fieldValue' => array('value' =>
$user_data['newspaper']))), array('name' => 'newwindow',
'fieldValues' => array('fieldValue' => array('value' =>
$user_data['newwindow']))), array('name' => 'healthsciences',
'fieldValues' => array('fieldValue' => array('value' =>
$user_data['healthsciences']))), array('name' => 'tags',
'fieldValues' => array('fieldValue' => array('value' =>
$user_data['tags']))), array('name' => 'news-category',
'fieldValues' => array('fieldValue' => array('value' =>
$user_data['newscategory']))), array('name' => 'unid',
'fieldValues' => array('fieldValue' => array('value' =>
$user_data['unids'])))</p>
<pre>
<code> )
)
)
);</code>
</pre></div>Matttag:help-archives.hannonhill.com,2010-02-09:Comment/405895192016-08-23T22:10:43Z2016-08-23T22:10:43ZMulti-select<div><p>Hi Matt,</p>
<p>If you want to use my library, then it will require only a few
lines of code to solve your problem. Of course you have to learn
how to use it first.</p>
<p>If you want to struggle with your own code, you may still want
to look at the source code of my library. It is very likely that
you can find answers for most of your questions.</p>
<p>Wing</p></div>Wing Ming Chantag:help-archives.hannonhill.com,2010-02-09:Comment/405895192016-08-24T15:40:25Z2016-08-24T15:40:25ZMulti-select<div><p>Hi Matt,</p>
<p>It looks like you are very close, but need to wrap the
<code>value</code> array within your <code>fieldValue</code> array
one more time. Specifically, <code>fieldValue</code> is an array of
arrays containing the information for each individual value. For
example:</p>
<pre>
<code>$data = array(
...
'metadata' => array(
...
'dynamicFields' => array(
'dynamicField' => array(
...
array(
'name' => 'healthsciences',
'fieldValues' => array(
'fieldValue' => array(
array('value' => $user_data['healthsciences'])
)
)
),
...
)
)
)
);</code>
</pre>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/405895192016-08-24T17:06:17Z2016-08-24T17:06:20ZMulti-select<div><p>That did it. Thanks!</p></div>Matttag:help-archives.hannonhill.com,2010-02-09:Comment/405895192016-08-24T19:20:49Z2016-08-24T19:20:49ZMulti-select<div><p>Not a problem at all, Matt. I am glad to hear the proposed
change did the trick.</p>
<p>I'm going to go ahead and close this discussion, please feel
free to comment or reply to re-open if you have any additional
questions.</p>
<p>Have a great day!</p></div>Ryan Griffith