Not complete alert

cap

Member
Hello, is there a way to have some kind of alert fot all the records where not all answer to the questions are.given, or say it differently, whee not all field are filled?actually they are radiobutton...so where all not radiobutton (answer to question) has a choice? And if is possible, in a way that let me filterball records which have unanswered questions
Thank you
 
You can prevent saving an incomplete form by adding validations to your elements.

If it should be possible to save incomplete forms you can "mark" them with an additional element.

This can be a calc element (set it "Calc on save only"= yes) which is checking if any information is missing.

Or it can be a (hidden) field or radio or yesno (whatever) which is filled via a php form plugin (onBeforeStore).
See the WIKI for how to access your form data etc.

You can then use this element as a filter element (e.g. only accessible for admins), you can set "Use as rowclass" and add custom CSS to mark these records in your list view etc.
See WIKI and element's "List view settings" tooltips.
 
  • Like
Reactions: cap
ok thanks
i was trying to go these ways..yes the form must have the possibility to be saved even if not complete
And the alert must be visible to all user that fill the forms also!

So the calc element..the first things i thought to do. For what i know it should work on a style like:
If element1 and if element2 and so on.... checkin if all the elements have been filled, then return "Incomplete" or "Complete". Is this the way i should go?

I wanted to try the YESNO element, as you said, as this is most elegant and nice solution.
I tried to fill it using the php of the elements that need to be checked (radiobuttons)
So in the PHP part of the radiobutton, i am using the predefined actions to act on the YESNO.
The predefined action of PHP don't have possibility to assign a value to another element..but just for trying i tried to use ONCLICK if the radiobutton=* then action HIDE YESNO element
It is just to test the functionality..an with this i can hide/show the element.
But when i save the form it is just i did not do anything to the button..it doesn't save according to my choice.
example..i click * the YESNO get hidden.
Good, it is what i want. But when i save, it is not anymore hidden
So what i need to do to save it?

Also i need to assign a value so i wrote in php (in artBtn), using the ONCLICK this code

if '{artBtn == '*'}'
('lista___Completo') == ('1');


where artBtn is the radiobutton to be checked (so it is the answer) and "lista___Completo" the YESNO (or display) element that should say if there are unanswered elements.
* is the default for unanswered questions

But also i cannot get any change in "lista___Completo" whatever value i give to artBtn
So i don't know if there is an error in code or what else?
Do you think this path may work anyway?
 
Last edited:
I don't understand what you are trying to do where.

What is "the PHP part of the radiobutton"? Advanced "Eval populate"? This is only for populating the different options during form load.

What is "predifined actions of PHP"? There's nothing like this. There are Javascript actions, the predefined ones are only showing/hiding, not changing values.
Javascript (running in the user's browser, fiddeling with the HTML code in the browser) is totally different from php (running on your server), it's different syntax, different ways accessing data etc. etc.
If you want to change elements via JS you must use custom code in the element's JS section, in formX.js etc. (see WIKI, e.g. https://fabrikar.com/forums/index.php?wiki/index/#developers).

This is Fabrik forum, not about general PHP or JS questions, there's a lot in the internet to find and to learn.
For JS examples related to Fabrik have a look in the WIKI.

For setting/updating/manipulation element values on "Save" you can use the php form plugin, see also the WIKI for details.
https://fabrikar.com/forums/index.php?wiki/php-form-plugin/
 
Yes i was talking about that area that you properly understood and yes i made a mistake, i wanted to say javascript and not php
The code i have posted, i have put it there in the js section. Is that correct as a procedure?
If yes, then of course need to know how properly use the code and it another forum ok.
If i use only Js i don t need to specify the action then?as if i use "onclick" of course the value it is not saved with form as it needs the click for assign the value...
I think this is more fabrik related?
 
or to make it simplier for me, that i don't have knoledge of language i might do this
in each radiobutton i create the JS action: check the radiobutton, if it =* then show a display element with text "to be completed"
So it will be series of "or" ...if only one of the 30 radiobuttons is =* then the dislay element is displayed, otherwise is hidden.
Seems a nice solution, not to heavy in calculation, isnt'it?
But i still need to save this value..as this check is made only on the action onclick..how can i do?
Also..a similar diplay element would be searchable?
 
You can use a calc element (which needs PHP) with ajax calc enabled, using all relevant elements to display (and to store) "to be completed" (you can add some CSS) or nothing.
 
  • Like
Reactions: cap
I can do it with calc..done it already and it works
As i said the yesno element would be nicer as in list view it show the symbol..equivalent to yes no and it is much nicer for the user

I am trying to look at the example of js you linked...
but i just cannot go on, with my knowledge of js...without knowing the instructions first, the syntax then..it is like i should invent them :)
I know it should be a very easy instruction
in the radiobutton the javascript should be:
on load/save if this element = * then yesno element = 0
But how do i write it?
 
Or it can be a (hidden) field or radio or yesno (whatever) which is filled via a php form plugin (onBeforeStore).
See the WIKI for how to access your form data etc.

You can then use this element as a filter element (e.g. only accessible for admins), you can set "Use as rowclass" and add custom CSS to mark these records in your list view etc.
See WIKI and element's "List view settings" tooltips.
And please don't post in F3 GitHub issues.
 
And please don't post in F3 GitHub issues.
ok

i am working at the plugin section of the form now
I have selected the process script choice to "onBeforeStore"

then i added this code

if ('{lista___artBTN}'=='*')
('{lista___Completo}' == '1')


where lista___artBTN is the radiobutton
and lista___Completo is the yesno element
nothing happen though!
 
ok thank you
a very good start
i need help in translate it as i don't understand what is
$formModel->formData and $formModel->updateFormData
do i need to substitute them with my data?or are just indicators?

i have put it like this

$test = ['lista___artBTN'];
if ($test === '*')
{
('lista___Completo', '1', true);
}

and it don't work!
 
Sorry, but what is so difficult to follow this WIKI example
Conditionally updating a form's value on Save(top)
Lets say we want to update the field 'sport's value to 'badminton' when the field name's value is 'rob'. To do this the php would be:
PHP:

$name = $formModel->formData['tablename___name'];

if ($name === 'rob')
{
$formModel->updateFormData('tablename___sport', 'badminton', true);
}

You must use full element names ('table___element') with the onBeforeStore setting and short element names ( 'element' - no table name) with the onAfterProcess setting.
If you want to be a Fabrik developper (i.e. not only using the plenty out-of-the-box possibilies but also using the PHP and JS hooks) you have to know about JS, about PHP, about mySQL etc.
before digging into Fabrik specific calls, placeholder syntax etc. about which you can find informations in the forums and the WIKI.

The forum is not the place for learning basic programming skills.

Nor forums nor WIKI are perfect, there always can be missing or wrong information which then can be asked in the forum.
Also if you are a beginner it's clear that you have more basic question about Fabrik.

But all work on Fabrik, WIKI, forums is voluntary.

Meanwhile a lot of people tried to help you. But it's not motivating if you are posting one thread after the other, often with similar questions, not following the hints you get, having the impression that you don't try to get informations out of the WIKI and forums yourself etc.
 
Sorry but a language cant be learn so quickly
So certain kind of hints wheter appreciable, are.not useful for me
I didn t ask you to be my tutor in the process of learning a language and not to be my tutor in becominc a Fabrik developper
I don't have no intention to become a Fabrik developer
I am helping, on a volunteer basis , my wife with this questionnaire, for her and hers colleague to have a better results in collecting datas useful for her project in the hospital where she works, where they need to locate those patients that may get a new, experimental , treatment.
As i have knowledge in this area, i am an IT, i build sites BUT DON T KNOW LANGUAGE, (and it is not my intention to learn more than what i need for this db), i decided to help her, for the sake of doing something nice for other people, just like you do here. And i don t blame her and her colleauge for not having hired someone to do this. THEY were doing it with excel...one file for each patient...it is what they can afford.

Other than that it is almost 3 weeks i am spending all the time free i have, to learn how to do it in fabrik, and i have learnt really a lot of things...but not the language as it is impossible learning this way, a part of being able to write few lines.
So i find particularly wrong when you talk about me not investing in finding and learning by myself...because is totally untrue
I know you don t have time to check and remember thing, but if you only look at the questions i asked at the beginning and the ones i ask now you might notice what a big difference in terms of deep in quality of questions how much more advanced are they now
ANd this wouldn t be possible to happen without a process of real learning.and advancing in understanding. i did the db..not someone else or you, with your hints but i did it.

That said..you could have just posted the code how it should have be written. Would have been quicker for you, for me and i would have really learned something, if it is your concern.

That said number 2..you don t know who is the persons who is writing posts in another part of the world. Just because it looks like some other, doesn t mean he is like the other...so please don t stay there judging...if you don feel like just don t answer, as you said you are volunteer...so do it if you feel like and thats all

A part of this i thanks you and all the other persons who helped me to go ahead, and i really went ahead..
Even if you don t notice i can tell you that with your hint i have learnt a lot, at least for what ot possible to learn in 20 days
I think i learnt more than an average user in my condition would learn, as i study a lot!
 
Last edited:
Sorry, but what is so difficult to follow this WIKI example

anyway.,.,that code..of course i see it, i tried to use it, i tried to adapt it and i hav eposted how i understood it should be used
but it don't work
not even like it is just putting my elements name
and yes it is difficult to understand, really difficult when you don't know which ones are the variables, which are the commands ecc...in general what are the conventions used in the examples

for example
$name = $formModel->formData['tablename___name'];

formModel..what is?shall i leave it like this?
>formData ..what is?shall i leave it like this?
tablename__name ...here i was expecting the element name..so tablename___elementname....but what is tablename___name?
 
upload_2023-8-21_15-57-21.png

You have a (short) element "Name" (corresponds to the column name in your database table)
You have a "Full Element Name" (composed from your database table name + 3 _ + column name)

So if you have examples with table___element or your-table___your-element or full-element-name or table___element-name or tablename___name or tablename___elementname or similar replace it with your "Full Element Name".

If it says something like "short element name" use the "Name" (column) only.
If it says something with "raw" append _raw
 
so if i understand well i should use the full name

so i used this code

on beforestore

$name = $formModel->formData['lista___artBTN'];

if ($name === '*')
{
$formModel->updateFormData('lista___Completo', '1', true);
}



but it doesn't happen nothing!
 
lista___artBTN is the fullname of the radiobutton to be checked
and both vaue and label are *
so i can't be wrong
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top