saschaschefenacker
Forum Replies Created
-
Achieved to access the label and the value of the actual submitted form using:
` public function handle( $form_id, $response_id, $response ) {$filename_label=”testfile_label.txt”;
$filename_result=”testfile_result.txt”;// file_put_contents($filename_label,””);
// file_put_contents($filename_result,””);$total_count = torro()->results()->query( array(
‘number’ => -1,
‘count’ => true,
‘form_id’ => $form_id,
) );$results = torro()->results()->query( array(
‘number’ => 1,
‘offset’ => 0,
‘form_id’ => $form_id,
‘orderby’ => ‘timestamp’,
‘order’ => ‘desc’
) );foreach ( $results as $result ) {
foreach ( $result->values as $result_value ) {
file_put_contents($filename_result,$result_value->value,FILE_APPEND);
file_put_contents($filename_result,”,”,FILE_APPEND);
}
file_put_contents($filename_result,”\n”,FILE_APPEND);
}$form = torro()->forms()->get( $form_id );
foreach ( $form->elements as $element_form ) {
if( ! empty( $element_form->label ) && false !== $element_form->type_obj->input ) {
file_put_contents($filename_label,$element_form->label,FILE_APPEND);
file_put_contents($filename_label,”,”,FILE_APPEND);
}
}
file_put_contents($filename_label,”\n”,FILE_APPEND);
}+1
Would be great to have an example how to access the actually submitted form values in the handle methos.
I guess it is something about
– use form_id to get containers
– access actual container
– get elements
– use element with the given labels in form
but not sure how the code needs to look for that one (and if my idea is correct at all)