Processwire API form, modules form, admin form render
<?php
/**
* No Fieldset
*
*/
// Build form
$form = $this->modules->get("InputfieldForm");
$form->action = "./";
$form->method = "post";
$form->attr("id+name","FORM_ID");
// Fields
$f = $this->modules->get("InputfieldRadios");
$f->attr('name', 'radio_option');
$f->label = 'Radio Options';
$f->options = ["1" => "Yes", "0" => "No"];
$f->required = true;
$f->defaultValue = 1;
$f->optionColumns = 1;
$f->columnWidth = "100%";
// Add ffield to the form (do this for each field)
$form->append($f);
// file
$f = $this->modules->get("InputfieldFile");
$f->attr('name', 'file');
$f->attr('required', '1');
$f->extensions = "zip";
$f->label = "Update Zip";
$form->append($f);
// Submit
$submit = $this->modules->get("InputfieldSubmit");
$submit->attr("value","Anmelden");
$submit->attr("id+name","submit");
$form->append($submit);
echo $form->render();
// Or inside a class
return $form->render();
<?php
// Build form
$form = $this->modules->get("InputfieldForm");
$form->action = "./";
$form->method = "post";
$form->attr("id+name","FORM_ID");
// Build fieldset
$fieldset = $this->modules->get('InputfieldFieldset');
$fieldset->label = 'Fieldset';
// Fields
$f = $this->modules->get("InputfieldRadios");
$f->attr('name', 'radio_option');
$f->label = 'Radio Options';
$f->options = ["1" => "Yes", "0" => "No"];
$f->required = true;
$f->defaultValue = 1;
$f->optionColumns = 1;
$f->columnWidth = "100%";
// Add field to fieldset (do this after each field)
$fieldset->append($f);
// Add fieldset to the form
$form->append($fieldset);
// Submit
$submit = $this->modules->get("InputfieldSubmit");
$submit->attr("value","Anmelden");
$submit->attr("id+name","submit");
// add submit button to the form not fieldset
$form->append($submit);
// return form
return $form->render();
<?php
// Build form
$form = $this->modules->get("InputfieldForm");
$form->action = "./";
$form->method = "post";
$form->attr("id+name","FORM_ID");
// PageAutocomplete (get users)
$f = $this->modules->get("InputfieldPageAutocomplete");
$f->label = 'Select User';
$f->name = 'user';
$f->required = true;
$f->maxSelectedItems = 1; // single item, comment or use 0 for multiple
$f->template_id = $this->templates->get("name=user");
$f->searchFields = "name email first_name link";
$f->labelFieldFormat = "{first_name} ({email})";
$f->columnWidth = "100%";
$f->value = $users->get($input->get->user_id); // predefined value
// Add ffield to the form (do this for each field)
$form->append($f);
echo $form->render();