Page MenuHomePhabricator

[SPIKE] Create Form to Capture Prototype Data
Closed, ResolvedPublicSpike

Description

Background information

As a developer I want to prototype a workflow whereby a form can capture test data.

***Note: The form can be created in OOUI/Codex or both.

Questions

  • Can we capture form data and redirect to a special page?

Using the documentation found at https://www.mediawiki.org/wiki/Manual:HTMLForm_Tutorial_2 we can use:

$arrayOfFormElements = [
			'From' => [
				'label-message' => 'pirs-from',
				'type' => 'text',
				'required' => true
				'default' => '',
			],
			'To' => [
                                'label-message' => 'pirs-recipients,
				'type' => 'text',
				'required' => true
				'default' => '',
			]
HTMLForm::factory($displayFormat, $arrayOfFormElements,$this->getContext(),  'form-name');
  • Can we capture form data and output to screen.

Yes, using the setSubmitCallback( [ $this, 'your-callback-function-name' ] ); provided by the form factory, we can handle our form processing on submit

	public function your-call-back-function( $formData ) {
	
		//Sanitize form data
               //Send to storage, log, etc


	}

Sample Mockup

Screenshot 2023-04-11 at 1.03.14 PM.png (1×1 px, 112 KB)