Jump to content

lamarh

Members
  • Posts

    10
  • Joined

  • Last visited

Recent Profile Visitors

177 profile views

lamarh's Achievements

  1. This works great if there is data in the cell. I need to also highlight cells that are empty, but when I change it to (element.innerHTML === '') The cell color doesn't change. Any help would be appreciated!
  2. I have a table of docents who are in one of two programs (art or garden). The docent logs in with authentication. After logging in, the docent sees a tabular report of all lessons they have signed up to teach. Is it possible to customize the header with javascript so it contains the graphic (logo) specific to the art or garden program?
  3. I successfully used the javascript by TellMeWhy in a submission page, but I can't get it to work in a details page. I changed was InsertRecord to EditRecord and put it in the footer of a details page and added an alert box. I get "Uncaught TypeError: Cannot read property 'value' of null" on the code highlighted in red. Any insight would be appreciated! <script> document.querySelector("input[id^='EditRecordList']").addEventListener('change', function() { document.getElementById('cbParamVirtual1').value = document.querySelector("input[id^='ComboBoxEditRecordList']").value; alert('list updated'); }); </script>
  4. Is it possible to count records in a table using javascript instead of a calculated field so the comparison is done right before submission? Or, is there a way to force fields with calculated values to refresh prior to submission? Possibly a custom button that refreshes the fields then submits the form? I've run into a snag using calculated values. Virtual15 is a calculated value and counts how many of a courseID are scheduled for the selected Lesson Date SELECT Count(Lessons_courseID) FROM _v_active_lessons WHERE Lessons_courseID=target.[@field:Lessons_courseID] AND Lesson_Date=target.[@field:Lesson_Date] Virtual8 is also a calculated value that uses CASE WHEN to determine if it's ok to schedule. We can only teach one of each courseID per day. The case statement is checking for other restrictions as well, but they are not dependent on a record count from the active_lessons table. CASE WHEN [@cbParamVirtual15] <> 0 THEN 'This lesson is scheduled for another teacher today. Please select a different day.' ELSE 'ok to schedule' END Then, I use this javascript in the footer to prevent form submission <script type="text/javascript"> document.addEventListener('BeforeFormSubmit', function(event) { // prevent form submit if not ok to schedule // if user forget to choose required fields date or time, proceed with submission to generate required field error // alertok variable prevents blank alert box var Input1 = document.querySelector("span[id^='cbParamVirtual8']").innerText; var alertok = 1; if (Input1 == 'ok to schedule' || Input1 == ' ') {} else {event.preventDefault(); if (alertok) { alert(Input1)} alertok = 0; } }); </script> The issue: If the lesson is not already scheduled for a selected date, two users can simultaneously select the same lesson for the same date and both will get the 'ok to schedule'. This allows both users to submit the form and I end up with double signups.
  5. Problem solved and got rid of the javascript completely. I added a virtual field (Lead_on_load) that loads the value of Lead_Docent when the page loads. The Lead_Docent field is now a calculated field that either loads the user's ID or Lead_on_load depending on the status of the check box. When there is already a value in lead_docent, there is a rule to hide the checkbox so it's value is zero and Lead_Docent is "reset" to Lead_on_load. I hope that makes sense! I couldn't figure out why the Lead_Docent field was throwing the error. Love that I got rid of the javascript!
  6. This is definitely an update form. The art docent searches the table for lessons that have been scheduled and selects one to teach. By checking the box, the Lead_Docent field should update to the user's ID, which is loaded into virtual1 as an authentication field. Once this is working, I add a rule to hide the checkbox when Lead_Docent is already taken by another docent so it can't be overwritten.
  7. I didn't know about checking for errors in console (newbie to javascript!) Thanks for catching the quotes typo! And yes, this is a details page. It's still not working though. I copied and pasted your script and checked for errors. At the line document.getElementById('EditRecordLead_Docent').value = docentID I get the error Uncaught type error: cannot set property 'value' of null If I comment out that line and change the alert to alert(DocentID + ' is signed up to lead'); the alert works, with the correct DocentID, so DocentID isn't null The javascript is in the footer and doesn't run until the user submits. I've triple checked for typos in the field name. Any clues?
  8. My app has two user bases, teachers and docents. Teachers schedule art lessons and docents sign up to teach the lessons. All docents and teachers have unique IDs and must log-in to the app. Docents can search the scheduled lessons and select a lesson to teach. Each lesson has 2 docents slots for lead and assistant. There are 2 fields for each slot - Lead_Docent and a virtual checkbox (check to lead); Assist_Docent and virtual checkbox (check to assist). If there is a value in Lead_Docent or Assist_Docent, I have a rule to disable the checkbox and make the docent field display only so the user can't delete/overwrite another docent. I need to assign the field Lead_Docent or Assist_Docent with the user's ID if the box is checked. This is what I've tried but it doesn't work. Help! Virtual1 is set to receive onload the value of the docent's ID through the authentication fields. Virtual 3 and Virtual 4 are checkboxes, value if checked is Y Lead_Docent and Assist_Docent are text fields assign docent.rtf
  9. Thanks for the help! I used another calculated field to check if the start time was before the end of recess/lunch AND if the end time was after the start of recess/lunch. If both are true, then the field returns a value ('lesson overlaps with recess', '... lunch'). Then I used javascript to prevent form submission if the value equals anything except 'ok to schedule' and also display an alert box with the value.
  10. Our app allows teachers to request art lessons from a volunteer art program. The lessons are varying lengths and teachers can request a specific start time. I have a calculated field that gives me the end time based on the lesson length and requested start time. I need to check if the calculated field falls between recess start/recess end, lunch start/lunch end or after school end. Can anyone help?
×
×
  • Create New...