Jump to content


Photo

Problem with repeater


  • Please log in to reply
3 replies to this topic

#1 Sevarf2

Sevarf2

    Sr. Member

  • Members
  • PipPipPipPip
  • 301 posts
  • 13

  • LocationBratislava

Posted 19 August 2012 - 05:38 PM

I'm setting up 3 repeaters for the user template (i guess i can use repeaters with the user template).
Well, when i'm trying to save some date via API with this code:

if ($input->post->submit_equipment && $input->urlSegment1=="equipment"){

    $camera = array();
    $camera = $input->post->camera;
    $user->setOutputFormatting(false);
    foreach($camera as $c){
        $cameraRow = $user->camera->getNew();
        $cameraRow->title = $c;
    }
    if($user->save()){
        $session->redirect("/profile-edit/equipment/success/",false);
    }

}

i got all my 3 repeaters filled with this data.
The other problem is when i try to create some data from the admin...look at the picture...Missing field...what ?

Attached Thumbnails

  • error1.png


#2 Sevarf2

Sevarf2

    Sr. Member

  • Members
  • PipPipPipPip
  • 301 posts
  • 13

  • LocationBratislava

Posted 19 August 2012 - 05:45 PM

OK i think i got the bug...
I created the other 2 repeaters using the duplicate/clone function.
Now i can see on "detail" tab the same value for all repeaters:
This repeater uses template 'repeater_camera' and parent '/gladmin/repeaters/for-field-152/'

Something wrong in the clone process ?

#3 ryan

ryan

    Hero Member

  • Administrators
  • 5,768 posts
  • 3105

  • LocationAtlanta, GA

Posted 20 August 2012 - 07:41 AM

Repeater fields can't be cloned yet. I couldn't find a way to make it workable in the short term, so I set it to throw an Exception if you try to clone an repeater field (preventing the clone from happening). It could be that you have one of the versions between when repeaters were added and when the repeater cloning issue was discovered, so you may want to upgrade to the latest. Though let me know if this is occurring even on the latest version. But I think that's very likely the issue, and that you need to create those fields without the clone. Please let me know what you find.

#4 Sevarf2

Sevarf2

    Sr. Member

  • Members
  • PipPipPipPip
  • 301 posts
  • 13

  • LocationBratislava

Posted 20 August 2012 - 07:44 AM

Another thing.
In my form i display a list of input text according to the available repeaters, the inputs are filled with the corresponding value, if no repeater i display only one input. (I can add more input with a button)
Now i noticed a strange behaviour, first the form displayed 3 empty input field for each repeater, because there was the option "Ready to edit" set to 3 so for my code there was 3 repeaters...
When i removed this option there still some messy, especially in the admin tree, i can see the repeater field duplicated and also the 3 "ready to edit" fields not deleted. See the picture

@Ryan: okay read right now, I thought to have the latest version...I'll update immediately... :)

Attached Thumbnails

  • repeater.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users