I know what I want to do but don't know how to do it. I've got a database of doctors and when filling out a form, want the second drop down list to automatically be populated based on the first choice.
So let's say I select "Primary Care Doctor" (this is dynamic from the database, I have that part figured out).
The second drop down list would automatically populate from the database where all the specialties are "Primary Care Doctor"
I've attached the code I have so far as well as the database structure.
I have an access database named physicians.mdb the table that the physicians are being pulled from is table. The fields are: physician and specialty (there's also an ID field that's the primary key).
Can't see your attachment but basically you want a query to load the second combo box like SELECT DISTINCT * FROM [Physicians] WHERE [SPECIALITY]='Primary Care Dcotor'. See how you go from there, or give us more details.
Related
I have a use case where the client should be able to filter out the data required by names. The number of names could be in millions and the user should have access to all of them in a dropdown list. There are certain features that need to be implemented with this dropdown:
Search the dropdown and get the filtered names according to the search string.
Click 'Include All' from the dropdown to include all of the filtered names.
Click 'Clear All' to clear all the selected ones (or a similar approach)
Be able to remove a few out of those selected ones
The filtered names could be in millions so how should I implement the following functionality?
Obviously getting all the data on the client side in one go is not an option as the size of the data could be 100+ mb.
The data is being fetched by nodejs/graphql from google bigquery using standard sql queries and being sent to a react based frontend.
I am currently working on a project that involves recipes. The front end HTML looks like this
here
The idea is that the user will input what ingredients they have, and when they click "submit" my program will query through a MySQL database to show what recipes they can make with the ingredients they listed.
As you can see, the user can input as many ingredients as they want.
In the javascript, I made it so that each input box has an incrementing ID. So the first input box has an id of "input1" and the second input box has an id of "input2" and so on.
What strategy should I use to gather all the data that the user input? Should I put everything into an array using javascript, and then pass the array to the backend where the array can be read and put into a Mysql query? The thing with an array is that I don't know how big it should be because I don't know how many inputs the user will choose.
The backend language I am using is python and Flask.
I need to change, depending an other field, the data record type of a lookup field.
Here my problem : I have a radio buttons field, where you can select "user" or "team". I need, when you select user, to display all users in a lookup, but if you select "team", I need to display all the "team"s in the same lookup.
Have you got an easy way to do it ?
Thanks for you answer
A custom lookup field can only contain one type of related entity (unlike the owner or regarding fields supplied as part of the platform).
To achieve your requirement you need two lookups (attributes) on the entity, one related to User and the other to Team. Add both of these lookups to the form. When the user selects User or Team from the radio button run some javascript to show/hide the selected field type. I'd also include some logic to ensure that on population of one field you clear the other.
You'll need to take the use of the two fields into account when writing any reports or queries.
I am using this plugin (http://farhadi.ir/projects/html5sortable/) to create a feature for a website where a user can add form fields on the fly.
The idea is that they will give the form a name (title), and then add a series for form fields. These form fields need to be drag and drop sortable (thus the plugin) so the user can rearrange the order.
Once they are satisfied with the order, they will click the "Create Form" button, and the data to create the form will be submitted.
The data itself will be stored in three tables. Table 1: Forms, Table 2: Fields, and Table 3: Forms_Has_fields. The Forms_Has_fields table will includes a sort_order column, which tells the system in what order to display the fields.
That's where this question is important: when a field is re-sorted using the drag and drop feature, I need a way to save the sort order in an or some other form control so I can parse it with PHP and create the fields properly.
If this was in PHP, I would just keep everything in an associative array: ($fieldname => $sortorder), but that doesn't seem like it's an option in javascript. Ideally, I could keep this in an array in Javascript, and then when sumit was clicked, dump that array as a JSON to an field, and POST it to PHP. But if that's possible, I don't know how to do it.
If there is another (more elegant) way to handle this, I am open to suggestions.
Turns out, I was making it more complicated than it needed to be. I am giving you the points because you answered my question; however I did find a more elegant way of doing it. The is, in fact, the order and array already. There is no reason to create a separate array to manage what is being saved in what order because the does it already. All you have to do is itterate through it with .each().
And, best of all, I didn't have to use global variables
I want to have 3 dropdown lists going like
Select:State
Select City
Select: Restaurant
When the first dropdown list has an item selected, the "Select City" list is updated, and when the second dropdown list has an item selected, the last one is updated.
I am stuck between 3 approaches:
Using Javascript to put in all possible values. And using form onchange to invoke the update method.
Prepopulate dropdown from database (MySQL).
A hybrid of the first two - first 2 with Jscript, last one from database.
Now how does the performance and pros/cons of each approach for hosting, VPS and PAAS compare?
For the sake of usability I would update the select boxes using Ajax calls.
Another benefit from choosing this approach would be that your application logic is mostly kept server side, which in most cases is easier to write tests for.
You could populate the first select box by querying in your view and passing the results down to your template. If you disable the other 2 select boxes you can active/populate them after the 1 one is selected through an ajax call.