Jump to content

Field Output


Michael
 Share

Field output is a way to change the way a fields answer/input looks after the form has been submitted. This allows a specific field for a specific form to be changed without having all the fields of that type, to be changed to look like it. 

In this example, we will use 2 Text fields, to show we can style the one without effecting the other.

Screen Shot 2022-02-23 at 10.40.59 PM.png

This is how the fields will look by default, it is pretty basic. It shows the fields name above it and the submitted value below. With field output, we will change the first fields look and feel from the second. First thing we will need to do is head over to our ACP and go to Community->Formularize->Field Output:

Screen Shot 2022-02-23 at 10.42.13 PM.png

click on "Create New", unlike the other advanced fields options, Field outputs can be applied to multiple fields of different forms. This way you can style a particular field and apply it to multiple fields of that type without having to alter the default html files for it or if you do not want to apply it to all the fields of that type, just a few of them.

Screen Shot 2022-02-23 at 10.45.39 PM.png

Also unlike the other advanced field options, this one doesn't use "raw" php, it uses the template logic from IPS.  Once you select the field(s) you want this field output to apply too (the list is searchable, so if you have a lot of fields you can narrow it down by typing in the fields title and clicking the check box beside it).  You will also see there is a code mirror editor and a tags box here. the Tags box contains common control structures for the IPS theme engine that can be used here, along with the fields value (in a formatted and raw state. formatted the default decoration from formularize being applied, raw is the raw value that is stored in the database for the field, incase you want to change something about how it is processed.). You will also have access to the field data itself like its name/id thru the $field variable which is the Fields object. If this field is part of a quiz or a quiz wizard type form, you will also have options for $rightAnswer (the right answer to the question), $correctClass (this class will either be the cFormularizeCorrect or cFormularizeIncorrect). if this isn't a quiz/quiz wizard type, these values will be null. 

Screen Shot 2022-02-23 at 11.17.08 PM.png

We've applied a min style changes here, saved the field output.

Screen Shot 2022-02-23 at 11.18.33 PM.png

as you can see, the field output has been applied to the field we told it to. That is pretty much it, if you are familiar with HTML and IPS's theme engine, you would be able to alter how the output of the field looks for any field you'd want. This would be useful if the field at a certain value represents something special, so you could highlight the answer or do whatever you wanted really. The only real limiting factor would be with your imaginition.

Like the other advanced fields options, this one can also be dangerous since the IPS template/theme engine can expose PHP functions and the IPS framework, be careful who you give access to this section. 

If you have any questions or comments, leave them down below. 


Comments

There are no comments to display.

×
×
  • Create New...