Search the Community
Showing results for tags 'processing'.
-
Hello, I'm building a form through the API. In that form I am using a repeater field that is setup with 5 Ready-To-Edit New Repeater items. In the repeater is only one text input field named "servername". Now I'm having trouble accessing the repeater field values when I process the form. I read through the docs at https://processwire.com/api/fieldtypes/repeaters/. But when processing form input post values things seem to be different. I add the field to the form with: $registrationField = $fields->get("reg_servers")->getInputfield($pages->get("/registration")); $registrationField->attr("class","form-control"); $registrationForm->append($registrationField); The field is there in the form and working fine. Now when processing the form, I need to access the values of my repeater. Here's the relevant code: if($input->post->submitregistration) { $registrationForm->processInput($input->post); $servers = $registrationForm->get("reg_servers")->value; var_dump(count($servers)); // this gives int 5, which is fine foreach ($servers as $server) { echo "<pre>"; print_r($server->fields->servername); //servername is my text input field in the repeater echo "</pre>"; } exit(); } In the print_r output I can't find the value of my fields. I also tried var_dump($server->servername) and var_dump($server->servername->value) inside the foreach which gives an empty string. var_dump($server->fields->servername->value) gives null. How can I access my field values?
- 2 replies
-
- processing
- form
-
(and 3 more)
Tagged with:
-
Hi, I process 3 different forms with 3 different ids/names in the same template. Now my post values seem to get mixed up between the forms. What I tried is $profileForm->processInput($input->post); if ($profileForm->id == "profile-form") { //do something } Analogue with the other 2 forms. But that didn't help. In pure PHP I would use $_POST['profile-form']. But I want to stick wit the PW API. There I found $input->post["name"]. var_dump($input->post["profile-form"]) is null. How can I access and process only the data from my profile-form form using the API? EDIT: Also var_dump($input->post) does not reveal anything about the form id
- 7 replies
-
- Multiple forms
- processing
-
(and 1 more)
Tagged with: