You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to dinamically set a widget attribute in PHP

Accepted answer
12
Views
2
Comments

Summary:

I need to set the max_year attribute from the DateInput widget dynamically

Content (required):

I am trying to do something like this:

<?php $max =  date("Y", strtotime("2 years")); ?>

<rn:widget path="input/DateInput" name="Incident.CustomFields.Patient.Patient_DOB" max_year=<?= $max; ?> label_input="Patients Date of Birth (mm/dd/yyyy):" required="true" />

No errors are displayed, but the rendered HTML ignores the attribute as is

Version (include the version you are using, if applicable):


Code Snippet (add any code snippets that support your topic, if applicable):

<?php $max =  date("Y", strtotime("2 years")); ?>

<rn:widget path="input/DateInput" name="Incident.CustomFields.Patient.Patient_DOB" max_year=<?= $max; ?> label_input="Patients Date of Birth (mm/dd/yyyy):" required="true" />

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!