formio: How to populate fields without custom javascript code? - formio

I have searched for hours and tried several approaches. No luck.
Scenario:
There is a formio Resource Form for Doctors that includes the Doc's practice number, name, address, etc.
A new form is created for prescription medication. The form has a Select component to find the doctor's practice number. Once the correct doctor is selected, the fields showing the Doc's name, surname, address, etc., must be automatically populated.
I understand that anything is possible with custom code, but this is such a common requirement that I'm convinced it can be done with standard functionality.
Can you show me how to do this?
Thanks,
Alan

In the validation tab, do a custom validation.
Using the drop down's value, look up the doctor's information.
Then, use the following code as a guide to update your fields.
FormioUtils.searchComponents(form.components, {key:"address"})[0].setValue("PO Box 123");

Related

Create a Google Form (or similar) that verifies Student ID before submission

Context:
I teach at a university with mostly monolingual, English-speaking teachers, and students with mostly Russian and Kazakh names.
I want to create a simple form (like this https://docs.google.com/forms/d/1zo0vSfrH-xIosENy1wVjOd_VvPL5LL6UX6g4VqIPFn0/viewform ) that would keep track of reports of plagiarism on a Google Sheet (like this https://docs.google.com/spreadsheets/d/1h2nAvCq31xumi4SvjMvWWp8RR7ppJ_NtLCiuvrLqVkc/edit?usp=sharing )
Having the English speaking teachers type in Russian and Kazakh names would likely lead to mistakes. There are too many students at the university to choose them from a drop-down menu, and would be too many teachers and courses to create separate Google Forms for all of them, or to use Google's branching page choices (it would require creating hundreds of pages). So I would like instructors to be able to type in the Student ID # and their own Instructor ID #, and then have some way to verify that they have typed that information in correctly (so we don't have the wrong students being penalized, or penalties that don't get assigned to any student at all).
Questions:
1. Is there any possible way (via scripting, an add-on, etc.) to have Google Forms take the Student ID from Page 1, then look up the student's name on the Student Info tab of the Google Sheet and insert it into the text field on the second page of the Google form, so the instructor can verify it's the correct student? (Or any other technique anyone can think of that would allow a Google Form user to verify that they had entered the correct data, or help manage the massive number of choices of students in a university of several thousand students.)
If (as I'm afraid), there is no way to do it with Google Forms, can anyone suggest a Form creation platform that would do something like this, and that would integrate with Google Sheets or something similar?
Any help would be appreciated. Thanks in advance.
If you are open to doing it differently I'd go this route...
1) Use a short answer box and allow edits to answers.
2) Put the onSubmit() trigger into the sheet. When a submission comes in, send a follow up email to the person with the ID that they typed and the student name that it corresponds to. Let them know that no action is required if that is correct. If it isn't correct, they should edit their response with the edit response link which you can get using getEditResponseUrl(). I'd call it done right here and only worry about additional features if they are needed. It isn't as ideal as verifying at the time but would get the same thing done for people that can't keep their IDs straight. :-)
3) But... if you have people that keep messing up and they don't fix their issues or whatever, add a link in the email to confirm that the entry is accurate. If it isn't then a weekly/daily task runs that deletes any entries that haven't been confirmed and are older than Y days.
4) Alternately, instead of verifying what they type, give them drop down lists made up of a combination of student ID and name. I'd have multiple lists, depending on the number of active students. One or many though, make a script in the sheet that updates the dropdowns in the form either on edit or by manually running the script, either from a menu item or by attaching it to an icon on the page where the IDs/names are at. They should see 12345 - Joe Smith as the option and can find the right one if that student name doesn't match the ID they thought they should use.
I have a script like #4 that I use to populate a form with updated products whenever the list changes. I tied it to a big red button JPG to help the end users remember to run it when they change something, as a menu option didn't work and running every time there was an edit was too much.
If you list of students/IDs also includes the teachers/classes/etc you could even do custom forms for each staff member that uses the form that only populates their students. Not sure how many staff you have so that might not be practical. Though again, once you have the script and the data is accurate, updates are a single click.

Add Custom User Field (Dropdown) in Moodle

Hi I need to add Custom User Field (Dropdown) in Moodle. I know I can add it through https://docs.moodle.org/24/en/User_profile_fields and https://docs.moodle.org/dev/User_profile_fields
I went ahead with above method and added dropdown accordingly. However, when I see it in database, {user_info_field} it shows only one row with my select fields seperated by new line. Screenshot is listed.
I want these params to be appear in separate rows. Because, I've few development in pipeline which involves creation of custom invoicing plugin that allows to store pricing for each university.
That is how dropdown fields store their options in Moodle - all the values, separated by newlines.
If you want a list of possible values, retrieve mdl_user_info_field.param1 then use explode("\n", $fieldvalue).
I Used in built cohort system to categorized users in different University. Here I didn't have to create custom profile field.
For invoicing plugin, I will manipulate same cohorts (in my case University) by creating local plugin which adds tables to database field. Thank you all for your help.

Create a specific form in Drupal

I need to build a form where user can have an infinite number of identical fields, depending on the number which he entered in the previous field 'Number of steps'(for example).
Maybe someone have any idea?
I recommand you to check the Form API of Drupal and especially the #ajax property
Here is a great example on how to achieve what you need.

Best Product Listing Option for Concrete5

I'm going to be creating a Concrete5 website that will feature product listings. The listing system must offer all your typical ecommerce features, minus the ability to purchase items. It's strictly for browsing purposes only.
For example:
- Browse by category
- Search products
- Listings/results page with thumbnails and brief information (title, description, price in US/CAD, manufacturer, maker, etc.)
- Products single page (with detailed information, attributes and gallery/images)
All the things you'd expect to find in a listing system.
My issue is I can't find a specific add-on for something like product listings. This leaves me thinking that it may be best to use the e-commerce add on and do my best to hide anything related to the cart/payment process. That way it could just be used for everything else it offers.
What are your thoughts on this? Is there a better option?
Thanks for the advice!
Use the page list block. It has everything you need except for searching. But, in essence, that's what your requirements call for -- listing of pages.
Create a page type for your "product". The "brief information" can be in the Content block, or you can set as attributes. You'll probably want to make some minor changes to the block's view (by creating a new template) that displays the image as you want, the proper attributes, etc. Something similar to http://www.concrete5.org/documentation/how-tos/designers/styling-the-page-list-block/
There are several adanced page list blocks in the marketplace. You might want to start with those.
Right creat Page type.
After creat Page attributes.
Add a block page_list create a template for it and filter by attributes.
You can even use ajax to filter.
http://www.weblicating.com/doku/doku.php?id=cheatsheet/#.UbR7P0BmiSp
U can find here about page_list or read documentation Concrete5.

Dynamic Form Fields

I'm not exactly sure what to call the thing i am searching for. If I knew what to call it I might find the answer, so if you have an answer to my question or even know what I can search for that would be very helpful.
I am trying to create a simple php form that has standard fields like name, email, etc. I want to add an event type field that is a drop down with pre-selected values (i.e wedding, birthday, etc). Once they select a particular event I want other options to appear.
For exmaple they would select wedding and then date, venue, etc would then come up. If they selected birthday, then different additional options would appear.
Does anyone know the technical term for this, or where I can find a tutorial on it? Does it require ajax or jquery or something else?
Thanks for your help.
You could do this with jQuery. It sounds like you want more than just dynamic select (drop down) inputs. You could check this blog post out, but that really only covers the drop down fields.
It sounds like you want something fairly custom. You could separate your form into the individual steps and hide many of the fields to start. With jQuery, you can apply event handlers to fire functions when something is selected and then the function would determine what fields to show.
You don't really need to use AJAX unless you need the options (specifically drop downs) to contain options which are pulled from a dynamic source (e.g. a database).