Portal template radio group - how?

openEMR 7.0.2(1)

Hi. ok, I give up, how does the {ParseAsHTML} directive work?
I’m trying to include a radiobutton group in my template, and added the {ParseAsHTML} directive, hoping that would allow entry of html code, but no luck.
I tried adding this directive at the top of the document, and inline with each html element specification, but no luck
I also tried clicking the “source” button in the cke editor, and adding the html code in source mode. Also no luck
Is it possible to add a radiobutton group to a template (other than the supplied y/n and true/false pairs)?
Thanks

You can only use the available plug-ins for input items

Really? {ParseAsHTML} doesn’t make that possible? That’s unfortunate

Just converts text EOL to html <br>
If you wish to add new components to use in templates that are used to replace in templates go here: src/Services/DocumentTemplates/DocumentTemplateRender.php
See private function doSubs($s, $formData): mixed

Ah, ok. Thanks for the pointer for adding my own components. A radio button group would be quite nice. Will try to create that

Ok, so I made this. Seems to work, for showing a radiobutton group. Saves radiogroup state, and redisplays the selected rb if the document is shown again in portal or in Auditing tool in openEMR. Rb’s don’t show in generated pdf, though

			} elseif (preg_match('/^\{(RadioGroup):(\w+)\}/', substr($s, $this->keyLocation), $matches)) {
				// matches {RadioGroup:caption1_caption2_caption3}
				$this->keyLength = 3 + strlen($matches[1]) + strlen($matches[2]);
				$matchesArr = explode('_',$matches[2]);
                $this->grp_cnt++;
				$radioCount = -1;				
                $sigfld = '<span class="fcuGroup mx-1" id="fcradio' . $this->grp_cnt . '">';
				foreach($matchesArr as $buttonCaption) {
					$radioCount++;
					$fc = ($formData['fcradio' . $this->grp_cnt] ?? '') == "fc" . $radioCount ? "checked" : '';
					$sigfld .= '<label class="mr-1">' .
                    '<input class="fcuRadio mr-1" type="radio" ' . $fc . ' name="fcradio' . $this->grp_cnt . '" value="fc' . $radioCount . '" />' . xlt($buttonCaption) .
                    '</label><br />';
				}				
                $sigfld .= '</span>';
                $s = $this->keyReplace($s, $sigfld);
            }

@hanksterr7
okay, you’re close Hank. I fixed to work but modified for RadioGroupInline and RadioGroupStacked for different U.I.
Beware that when including the $formData object save and restore for for is automatic so it didn’t work for you because you had syntax error in your PHP.
One problem is you should allow for multi words in options i.e Radio one_Radio two etc.
I’ll give you the source here in a bit then let me know by tomorrow and i’ll put in patch 3.

ended up with for patch
{RadioGroup:Patient Select Option_Provider Select Option_Vendor Select Option}
{RadioGroupInline:Patient Hide_Show Patient_…}

Audit

Ah, ok. You show the radio group differently in the Audit screen, vs the portal. In the Audit screen, you just show the selected RB value. And that would then pass to the pdf generation without difficulty. Nice!

Generally anything going to Audit are flattened forms meaning, rendered to a resolved document.
Others like questionnaires won’t get flattened until Print or sent to Documents. This way a questionnaire can be revised later for additional edits.

Notice I allow for multi word options for the use case of a series of statements or questions.

@hanksterr7 PR if you want to implement New Document Template radio group plug ins by sjpadgett · Pull Request #7837 · openemr/openemr · GitHub

Thanks! I’ll take a look at the PR. Appreciate the effort

I applied your modified 3 files to my patch 7.0.2(1) system and things are not working. The cke editor controls are no longer showing when I attempt to edit a template. And nothing shows in the portal when I select the template that has been sent to a patient. I expect I need to apply patch 2 to solve these issues. Anything else I should consider? Thanks