Page and User Selectors

Permalink
Hi there,

I've been trying tirelessly for past few days to create a new User Selector attribute to attach to pages containing audio files so that a visitor can go straight to the speaker in the audio file's user profile.

For some reason, I can't seem to get the user selection dialog to pop up; the page selection dialog will pop up fine (I used the same code from that as I know that works, just changed it to use the User Selector form helper instead) - see attached screenshot - the highlighted akID[51] is the failing user selector, the other akID[35] is the working fine page selector.

I read herehttp://www.concrete5.org/community/forums/customizing_c5/a-better-u...

that jQuery doesn't like square brackets. I attempted to backslash them out but to no avail (yet the page selector code happily uses square brackets??)

Any suggestions? Some of the code is below that seems to be causing massive issues.
public function form() {
      if (is_object($this->attributeValue)) {
         $value = $this->getAttributeValue()->getValue();
      }
      $form_selector = Loader::helper('form/user_selector');      
      print $form_selector->selectUser($this->field('value'),$this->request('value'), false);
   }
   public function saveValue($value) {
      $db = Loader::db();
      $db->Replace('atUserSelector', array('avID' => $this->getAttributeValueID(), 'value' => $value), 'avID', true);
   }
   public function saveForm($data) {
      $db = Loader::db();
      $this->saveValue($data['value']);
   }


Thanks!

1 Attachment

harveyappleton
 
harveyappleton replied on at Permalink Reply
harveyappleton
Oh and a side note:

using this solution
http://www.concrete5.org/community/forums/customizing_c5/adding-pag...

I was able to get the dialog box to open to pick a user and put it into the user selector box. However it DID NOT update the hidden form element and neither did it send the user ID picked to the controller.php, so it never made it near the DB.

I can get the user picker to work and update the hidden element if I give it a name that does not use square brackets (eg "userselector") but then that data doesn't seem to make it back to the controller.php in the $data form.

Hope some wise soul knows a solution!! :-)