build a questionnaire

cap

Member
Hello i need to do a simple task
I have a questionnaire with several questions. Each questions can have as answer "YES" or "NO"
According to the answer, there is another field that assume a value
if yes the field is E, if NO the field is NE
Some questions have another field that have another similar formula, but this time from the 2nd field
I ll need to have all the questionnaire which i can query and filter from name or from one of the questions.
It should not be difficult
But my first stop is how to assign a value to afield according to another fiedl value?
i am trying to set a field element and use an expression like
if "lista_haart" like "YES" then E
but of course don't work
thanks for help
 
Last edited:
i have downloaded amd installed buy i don't see where is

ok i was not enabled..
where do i edit ?i use the element as calc..and what shall i do afer?i mean it seems it need code..i don't know what to write
 
following the help i come to this code i put in "calculation code"

return (int)'{lista___lista___haart}'

where lista is the name of database table, and lista___haart is the name of the element with radiobox but i get error
it can't work anyway as the radiobox is YES or NO, but i need to ouyput E or NE
 
Assuming the values (not labels) of your radio element are "yes" and "no", it should be:
PHP:
$radioelement = '{tablename___radioelementname_raw}';

if ($radioelement == 'yes') {
   return 'E';
} else {
   return 'NE';
}
 
Ok i ll try tomorrow
What is theradioelementname_raw, what raw stand for?
The element is called lista___hart at least is what i see in the element area

I forgot: the radiobox don t have a default value, but undprcified. So when is still neither yes or no, i must have blank for return. How do i put this?
 
_raw means that it uses the value of your radio element, not label.

And yes, you need to change the placeholder (tablename/elementname) to match yours.

I recommend you to read Fabrik wiki as there is almost everything you need with sample code snippets. And for generic PHP, Stackoverflow and ChatGPT are very good resources. It will make your life a lot easier.
 
Last edited:
hello
alleluia i become mad but eventually i did it
iwas usinthe variable $radiobutton which i shoukldn't...when i gaveanewname it works!7
but there are 2 issue now
if YES = E
if NO =NE
if no choica made =blank
Now i akways have NE if i dont choose YES
ANother issue, the fielld don't get automatically updated. It is correctly save but when i open the form it is always on NE, and if change to YES remain to NE
 
i was able to use the code for the proper choices..still i need to have the update, and this is somehting i haveno clue

btw..so i can use gtp, really?but how to question?what would you ask for this case, update?
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top