Hi, Are you setting explicit IDs or are you relying on auto_id()? If it's auto_id(), then they're not created until render time - in which case you'll need to inspect $form->render_data()
To get the name, you need $element->name(), as it also isn't put into the attributes until render time. Again, if you inspect $form->render_data(), it should be in the {attributes} by then. Cheers, Carl 2009/8/31 Ascii King <t...@swattermatter.com>: > Why doesn't this code return the name and id of the element? > > I have declared all of my variables, I just didn't include it here. This > code will put the title and maxlength attributes of a text field into the > Repeatables_List, but not the id or name. > > The code is supposed to find a text field that has a "title" attribute and > put a div tag right after it. The code fails because it never actually grabs > the name of the retrieved element. Why not? > > I have so much trouble understanding what is going on inside of the arrays > and hashes that I work with. > > ----------------------------------------- > my @Repeat_List = $form->get_all_elements({ type => 'Text'}); > > while (@Repeat_List->[0][$count]) { > > if (@Repeat_List->[0][$count]->attributes->{'title'}) { > tester = tester . "title == " . > @Repeat_List->[0][$count]->attributes->{'title'} . "<BR>"; > tester = tester . "id == " . > @Repeat_List->[0][$count]->attributes->{'id'} . "<BR>"; > tester = tester . "name == " . > @Repeat_List->[0][$count]->attributes->{'name'} . "<BR>"; > tester = tester . "maxlength == " . > @Repeat_List->[0][$count]->attributes->{'maxlength'} . "<BR>"; > > $new_element = $form->element({ type => 'Block', id => > @Repeat_List->[0][$count]->attributes->{'id'} }); > # $position = @Repeat_List->[0][$count]; > $position = $form->get_element({ type => 'Text', name => > @Repeat_List->[0][$count]->attributes->{'name'} }); > $form->insert_after( $new_element, $position ); > } > $count++; > } > > $c->stash->{Repeatables_List} = tester; > > _______________________________________________ > HTML-FormFu mailing list > HTML-FormFu@lists.scsys.co.uk > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu > _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu