I have a html form which contains a pair of project/hours fields(the project being a select field and hours an input field) that i need to validate in my form.There are about 5 of those pairs. I want the user to be notified of an incorrect submission when one of the following happens: there is no project select and hours filled in any pair;when a project is select but hours aren't defined for that project and vice-versa.
How would I go about validating my fields in a pair?
Assuming a button is clicked by the user when the user thinks he is finished, you can check the selects and inputs with Jquery. If something is not ok, then tell the user and prevent the button from doing anything else.
Related
The website has a content type defined called an event, which is used in calendars and other displays. It has the following fields
Event
Label Machine name Field type Widget Operations
Title title Node module element
Group og_group_ref Entity Reference OG reference edit delete
Date field_eventdate Date Pop-up calendar edit delete
Description body Long text and summary Text area with a summary edit delete
Booking Details field_eventbooking Long text Text area (multiple rows) edit delete
Contact Details field_eventcontact Long text Text area (multiple rows) edit delete
Downloads upload File Multiupload edit delete
Retire from Front Page field_retire_from_front_page Date Pop-up calendar edit delete
Key Words field_key_words Term reference Check boxes/radio buttons edit delete
Meta tags metatags Meta tag module form elements.
Location locations Location module form elements
The content type has been use for over 10 years and there are over 6000 records of this type.
The majority of the records are one off events with no repeats, but some are regular events with repeats set up for once a month meetings etc.
I would like to write a view to identify those records which do not have repeating dates, and for which the date is in the past so these can be removed from the system, but I can't see a way of identifying which events have repeating dates and which do not.
Once the one off events can be presented in a view, View Bulk Operations can be used to remove them.
The repeating events are more problematic because some of them may still be in use, this would need to be determined as a second step or done manually.
The date module in use is Date 7.x-2.10.
It turns out to be relatively easy just filter on
Content: Date:rrule (empty) to pick up records with no repeats
Thanks to Tony Maynard-Smith for the answer.
very new to Access and I have what is probably a simple question that I've spent the last 2 hours researching and can not find an answer for.
I have a simple form, frmCheckOut, with two text boxes, DateCheckedOut and DueDate, and a command button, updateButton. The DateCheckedOut can be any date while DueDate is a calculated field (=[CheckOutDate]+14). The command button merely opens the forms record source query (qryOverdue).
Entering data into the forms DateCheckedOut correctly calculates the DueDate in the form, and clicking the button opens the associated query with the DateCheckedOut accurately reflecting the forms current information, but the DueDate with the calculated field is not updating correctly in the query.
Why is DateCheckedOut correctly updating in the query while the calculated field of DueDate is not?
(the button was built using the event builder, simple code but here it is
Private Sub updateButton_Click()
DoCmd.OpenQuery "qryOverdue"
End Sub
)
Opening a SELECT query does not update fields.
Saving calculated data is usually not advised. The DueDate value can be calculated in query or textbox whenever needed. Or even use table Calculated field.
Suggest you give controls a name different from the fields they are bound to, such as tbxOut and tbxDue.
However, if you must save, then use the AfterUpdate event of tbxOut with expression to populate the DueDate field:
Me!DueDate = Me.tbxDue
or
Me!DueDate = Me.tbxOut + 14
Big question: How can I make Access automatically fill in a cell in a form based on previously entered data?
I need to enter leave details for members of staff. I tend to enter these by date, and in one to two week chunks. Is there a way to have the next new record automatically fill in the date part of the record with the previously entered one?
Table structure
Staff: StaffID, Name
Absences: ID, StaffID, Dateaway, OtherDetails
I want it to automatically fill in DateAway with the entry of the row above it, or the previously entered row, as I will enter say 10 dates in a fortnight, but 50 entries over those dates. I enter them chronologically, and after the fact (So just defaulting to TODAY() won't work).
There's a shortcut Ctrl+' that does pretty much what I need, wondering if there's a way to do that with the generation of a new record.
You have to be careful with this. If your form is bound to a table/query, you're going to insert a junk record every time you're done with the form. However, if it's unbound you can do this using DMAX, in the After Insert event of the form.
Private Sub Form_AfterInsert()
txtDateaway.Text = DMax("Dateaway", "Absences", "StaffID = " & Me.txtStaffID)
End Sub
This is, of course, assuming your Dateaway field on your form is called txtDateaway and your StaffID field is called txtStaffID.
I am trying to display a list of open indents with check boxes before them each line. Based on the selection a report will be generated next with further details.
Table: xxind_mstr (xxind_nbr, xxind_shipto, xxind_askedby, xxind_date).
Is there any way that I can bring the records from xxind_mstr and place them in the FORM with check boxes ?
Note: This only works if dynamic. Never hardcode this approach.
Name each check box with the value of ROWID(xxind_mstr).
This way on the post you can read back through the each xxind_mstr getting the value of the the rowid.
Rod
I'd like some more info, just to know if I'm not talking rubbish here. You want to display the records in xxind_mstr as checkboxes, then upon selection of the report setup, fire the report respecting the checkboxes flagged? If so, then I'd use a browse pre-built with a temp-table containing the xxind_mstr records, and a "flagged" field, this being a logical view-as checkbox, and when they run the report, do a
FOR EACH ttxxind_mstr WHERE flagged = true, and you should have what you want.
I'm building a database in FileMaker 12 that will, among other things, keep a list of jobs (indicated by numeric ID) and the employees who had billable time for that job.
Given three tables:
Employee ( empName, empID, salary, ... )
JobHours ( empID, jobID, hrsWorked, ... , refID)
JobCost ( jobID, expenses, profit, ... , refID)
Where:
Employee is my personnel roster matching names to numeric employee IDs and stats (salary, et al) ;
JobHours is a list of employee participation -- whenever an employee spends time on a job, this table has a line that shows their ID, the job ID, hours worked, and a few other things;
JobCost is a daily record of jobs. One entry in this table refers to the activity for a single job on a single day. Additionally, each entry gets a system generated unique ID (since neither jobID nor date is unique) to relate to JobHours (resulting in a list of who worked on a particular job on a particular day).
I have a form showing records from JobCost. For each record, I can see in a portal, showing records from JobHours, who worked on that job on that day.
Now, the issue.
In my portal, I want to have a drop-down list of employee names pulled from a value list to create records in JobHours with the following criteria:
1) I need it to be a drop-down rather than a pop-up so it will respond to auto-fill from the keyboard. A drop-down will show the secondary value (employee name) from a value list while dropped down, and will respond properly to keyboard autocomplete on the secondary value, but once you've made your selection, it only displays the primary value (employee ID).
2) I need it to display names, not IDs, at all times. The pop-up does this perfectly. However, it doesn't seem to respond to the keyboard for typing autocompletes.
3) I need to store the numeric ID rather than the name.
I know how to satisfy any two of these criteria at once, but that's all. The whole database is working beautifully otherwise. Is this behavior possible?
One common technique is to use two fields, one directly on top of the other.
On the bottom, put your JobHours::EmpID field. Set it up as the drop-down list with the value list that you've specified.
On top of the JobHours::EmpID field put the related Employee::EmpName field. Set the field so that it cannot be entered in browse or find mode.
Now your users will see the Employee Name, but when they click that click will go through the top field and into the Employee ID field where they will choose the name from the value list.
pft's solution is one that I have long used, but I do still find it inelegant because the user still sees an existing id number in the field when changing the value.
If the type-ahead is important, I would use the popup menu. Once the menu has been activated either by tabbing into it or by clicking into it, the user is able to type from the keyboard and the selection will change based on what's entered.
I came to this thread looking for a solution to this same issue (allowing the user to pick from a list, show their choice, but store a related value instead). For example, choose a plant species name from a dropdown, show the plant species name in the dropdown field, but have it store the taxonomic serial number (TSN; which is more likely to stay the same over the years). This is easy to do in MS Access, but took a litlte more messing around to do it in FMP12.
How I solved it:
I created two fields in the table that would be storing the values: Plant_TSN and Plant_SciName. A relationship must exist between the values in these two fields. In my case, I store a SciName for each TSN in a lookup table. I then created two fields in my layout, one for each new field.
For the value you wish to store (ex. Plant_TSN):
Make the corresponding layout field a dropdown and include the show/hide arrow. Edit the value list you will populate the dropdown with to show the second (reader friendly) column but store the first column value. In the layout shrink the field to only show the arrow.
For the field you wish the user to see (ex. Plant_SciName):
make the other layout field a Edit Box and prevent field entry in either Browse or Find mode. But it up against the dropdown arrow created in the previous step to make what looks like one field.
Finally, back in the first field (arrow-only drop down) write a script to push the user friendly number (Plant_SciName) to the edit box when the user-ugly (Plant_TSN) value is picked in the drop down. I used the OnObjectSave script trigger of the dropdown formatted field. Script should be something along the lines of 1) Freeze window, 2) Go to Related Record (based on relationship in lookup table 3) Set Field (i.e. the edit box) and 4) GotoLayout[original] to offset the Freeze.
Probably not an entirely clear explanation, but I bet you will get it on your third read through! I would have posted a screenshot, but I apparently need 10 "reputation points".
Cheers.