I am trying to build up several paragraphs of text for a dynamically generated report based on a combination of selected radio buttons, drop-down lists etc. I will try to explain with a basic example…
So, depending on which radio button is selected then paragraph “A”, “B” or “C” is displayed. That part is very easy.
Paragraph A
This _TAXI_TYPE_ was inspected at … etc
Paragraph B
Due to this vehicle being a _TAXI_TYPE_, we have included £350.00 in our … into a fully licenced _TAXI_TYPE_. If you wish to disregard these costs at … etc
Paragraph C
The Experian M.I.A.F.T.R check is showing no adverse history against this _TAXI_TYPE_ and as such we can find no reason … etc
Then for example, in a drop-down list, “value 1”, “value 2” or “value 3” is selected.
Taxi Type Values
value 1 == “PSV”
value 2 == “private hire”
value 3 == “hackney carriage”
This “value” is then to be used inside paragraph “A”, “B” or “C” where there is a “_TAXI_TYPE_” placeholder.
So, in this example, I end up with
Paragraph “B” with “value 3” injected
Due to this vehicle being a hackney carriage, we have included £350.00 in our … into a fully licenced hackney carriage. If you wish to disregard these costs at … etc
One way I have thought of, was to do a search and replace, something like this…
paragraph_B.replace('_TAXI_TYPE_', drop-down.value_3)
Is this the correct way to do this type of thing, or is there another, better way?
Last updated: