Multiple radio buttons naming problem - html

i have a bit of logical problem here. I have a catalog of products that have unique ids and options that are displayed to the user through radio buttons. Now my problem is that a user must be able to select different options (from different products) and to submit them to a PHP script that handles this request (via POST). The problem is that the listed products are in one form, and to be able select multiple radio buttons i have to make them with unique names (and to handle the posted choices i have to guess the name of the button). Is there a way to make all the selected choices into array or something, cause otherwise i have to guess the POST-ed field every-time. I need to just pass the id and the options related to him, so i can extract the information from DB.
And one more what is the most convinient way to store selected choices through multiple pages (a.k.a paging - loaded through ajax) - cookies or temp variable.

Sounds like you should be using Checkboxes rather than Radio buttons - if you want multiple selection

I agree with barrylloid.
then, if you name all your checkboxes something like
product1_select[]
then you should be able to read the values of the selected boxes in the PHP backend using
$_POST['product1_select']
Good luck!

Related

Open the Edit List Items Window with a button in Access for ListBox Object

I have a List Box in my form.
I'm allowing the user to edit the contents which is a feature I'd like to have and the default feature works great for my needs. I know if you right click the list you get the Edit List Items Window too.
But my issue is most of my users are not Access savvy, so they may not know to right click to open the window. I'd like to make it so the blue edit button will open that window with VBA, but I can't figure out how to call opening that window with VBA.
Is this even possible, if so I'd love to know the call.
You can simulate the click on edit
Private Sub btnValueListEdit_Click()
Me.myListBox.SetFocus
DoCmd.RunCommand acCmdEditListItems
End Sub
But this is not recomended!
Have a look at Add items to a Value List from Allen Browne.
You can remove items that are actually being used in other records.
You can correct a misspelled item, but the records that already have the misspelled item are not corrected.
You can add items to your form, but in a split database, other users don't get these items. Consequently, other users add items with other names to their forms, even where they should be the same item.
If you answer No after using one of the new items, you now have items in the data that don't match the list.
If you answer Yes in an unsplit database, you introduce strange errors as multiple users attempt to modify objects that could be in use by other people.
If you answer Yes in an split database, the list of items in one front end no longer matches the lists in the others.
Your changes don't last anyway: they are lost when the front end is updated.
Conclusion
Use tables, not value lists, to manage lookup data. Create relationships with Relational Integrity.
Use these lookup tables (or queries based on them), as the RowSource for your combos. Do not use Value Lists for anything more than the simplest of choices that the user never needs to edit.
Use the Not In List event to add data to simple, single-field lookups such as types or categories.
If you only use Access 2007 or later, the List Items Edit Form property is a quick and easy way to nominate the form to use for managing the list items.
To edit the list in any version of Access, or to control how the editing works, use another event such as the combo's DblClick.

Microsoft Access - Create Form to Post Data to Intersection Table

I am sincerely sorry if this question has been asked before, however with my limited knowledge of using Microsoft Access forms I am having an issue that is likely a very simple fix.
At the moment I am trying to create a form that will allow me to post data into an intersection table using combo boxes, the purpose is to create a relation between Clients and Project Numbers, these are intended on being a Many-to-Many relationship.
Relation Example
To begin with one issue I am running into is that when I use the intersection table to select a unique Client Name I get multiple entries from the drop down menu when there are multiple items in the intersecting table.
Form Example
The second part of my issue is that I am unsure how to post data to the intersecting table once the dropdown selections have been made.
Any help is greatly appreciated, and I thank everyone for their time.
The first part is to create a form in which you find, and edit data in the main client table.
This form will ONLY be based on the single main client table.
You perhaps ALREADY have a nice form to edit the client table anyway. I mean, how else will users find and edit a client anyway? So this issue and problem will LONG be dealt with before you do anything else of use in the application.
The form based on this single table might look like this:
Ok, now close the above, and create a second form to allow adding some choices of favorite colors (or in your case ClientContract). So the form will be based on this child table.
Again, like the first form, this form is based on ONE table.
Make this form continues, so click on ClientContract table, and then from ribbon choose multiple items form from the ribbon. It will look like this:
Of course we don’t want the user to have to manually type in the color (or project in your case), so we drop in a combo box from the ribbon and use the wizard. MAKE sure the first column of this combo is the PK of the ProjectNumber table, but FOR EASE of reading and selection, include ProjectNumber and Project Description columns in that comb box. NOTE in above how I also had added that combo box.
Assuming you closed and saved this form.
Now open our first main client form in design mode, and drag + drop in the continues second form we just created onto this form. The resulting form will look like this:
Access will automatic set up he customer_ID for us (because it is a sub form attached to the main form that only displays the one main record).
Once the above works, then again close the lot, and open up our continues form in design mode and remove all the extra junk.
(leaving ONLY the combo box).
The result is this:

MS Access - populate checkbox list from table

I'm using a local Access database. Let's say I have 3 tables -
Projects, Contractors, Project_Contractors (linking table, multiple contractors can work on multiple projects).
I'm building a form to be used to create a new Project entry. I want this form to have a checkbox list of all the Contractors, so the form will add a new entry to the Projects table as well as populate the linking table.
I'm very experienced with SQL, but not with Access. Is there a way I can populate a list of form options directly from the Contractors to complete this? I'm using Access 2013.
A listbox control is pretty good at accomplishing this. With larger datasets it can be clunky to scroll through them all, and if you can't make it tall enough to show all rows you also lose visibility on previous selections, but it's pretty easy to set up and link to the Contractors table (you should be able to do it through the wizard, or type some SQL into the control source).
Turning on the multi-select property of the listbox should do what you are looking for. MultiSelect Property
Getting the selections out of the listbox to generate your append queries I think requires VBA. Here's a link explaining how to accomplish it. Clicky
EDIT: to more directly answer your question, you could use checkboxes by adding a boolean field (there's a checkbox option there) to your Contractors table and use the table as a subform in your entry form. I personally think that's bad design, and the steps to clean it up make it way more complicated than using a listbox.

Access--I need a list of dynamic check boxes on a form

I am trying to create a form in Access which will have a dynamic list of check boxes. It starts with a table tblMASTER_ATTACHMENT_LIST which will have three columns: MASTER_ATTACHMENT_ID, CLASS, and ATTACHMENT_NAME. (Before I go any further, this question is not about file attachments. Think more along the lines of an attachment to a report.) tblMASTER_ATTACHMENTS will be "pre-populated" with all possible reports and their classification. There will be another table tblREPORT_ATTACHMENTS, which will have the following columns: ID, REPORT_ID, MASTER_ATTACHMENT_ID, and ATTACHED_BL (boolean). So, depending on the class of the report, the list of possible attachments may change. I would like the list of possible attachments to be populated on a form, with check boxes next to each one to show whether it was actually attached or not.
I was thinking about a workflow such as once a user selects the class of report, to delete any records in the tblREPORT_ATTACHMENTS with the REPORT_ID equal to the current RECORD_ID, and then fill the form control with the results of SELECTing the records from the master table where CLASS = selected class.
If this workflow makes sense, I could use some help implementing it. Specifically, how do I build the control on the form that will hold the check boxes? If this workflow is not a very smart way to do, can someone suggest a better way? And explain how to do it?
By the way, I did search for this, but I don't really know what this type of thing is called. Makes it pretty hard to search for. If this is a common thing, perhaps someone could just point me in the right direction. In that case, a full answer here would not be necessary.

Sync two input fields in 2 different jsps

If I have 2 input fields in a jsp and i want them to be in sync always, I know the solution. Write an onchange event for each input field and call a function. This function will sync the two fields.
Now in my situation, the two input fields are in two different jsps. And they are both included in a third jsp. Is it still possible to sync the fields?
If both jsps result in a single html page, on client side you are still dealing with a single page. Approach described in question should work there.
Set an attribute in session, and use this value where ever you want using ,
session.setAttribute("userName",userName);
session.getAttribute("userName");