Jump to content

AsmSelect saving multiple values in CMS


Kola
 Share

Recommended Posts

I am a newbie in processwire. Apologies in advance if its a silly doubt.

I have an AsmSelect field in my CMS which is "assigned_to". It is user reference field which assigns multiple user to the task.

I want to save multiple users in this field in CMS using API. So far I am able to save one user at a time using following.

$p->assigned_to = $u->level1;            
$p->save();

I have tried few different things but I am not able to save multiple users in AsmSelect.

Please help.

 

Thanks in advance

Edited by Kola
Link to comment
Share on other sites

I have tried below code..this also doesnt work.

 

$p->of(false);

$p->assigned_to = array($u->level1,$u->level2,$u->level3);            
$p->save('assigned_to');
$p->save();

Link to comment
Share on other sites

@Kola - glad you figured it all out ?

The key thing here is that it's not really the ASMSelect inputfield, but rather the Page Reference fieldtype that's behind it - because you have that set to store multiple values you need to use the add() method. Same would go for checkboxes etc.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...