You are viewing limited content. For full access, please sign in.

Question

Question

Reload a field in Forms

asked on October 15, 2018

I hope this makes sense. 

 

Scenario:   

         I have a form that has two lookup rules pointing to a 'Stored Procedure' and a 'View' in SQL.  The form has 4 fields that the stored procedure uses.  A teacher name, a student name, a date, and a time.  When all 4 fields are selected, the stored procedure flags a column in the database called "Reserved".   The 'View' only returns times that are not flagged as "Reserved".  The drop down for the 'Time' field is populated with available times based on what the 'View' returns.  Upon initial load of the form and after the student name, teacher name, and date is selected.  The available times in the 'Time' field are correct.  

Problem:

        User A logs in and fills out the student name, teacher name, date, and time.  The database is updated properly and the selected time is flagged as reserved.  User B logs in and selects their student, the same teacher as user A, and the same date as user A.  The times that appear in the drop down are correct. The time user A selected does not appear as an option.  Now if user B selects a time and user A happens to change their mind and wants to select a different time.  The time that user B selects is still available for user A to select.  I believe this is working how it is designed to work.

Question:

         Is there was a way to have the 'Time' field reload the available times when clicking on the time field?  

 

0 0

Answer

SELECTED ANSWER
replied on October 17, 2018

Depending how lookup is setup (I say this because the Time field sounds like it loads based on dependencies - View), but you could do a Javascript with a "change" function that will basically clear out the Time once View is changes, forcing the Lookup to be done again.

You can do on View change or on Submit - it can check availability.

View change would be simpler to setup.

 $(".view select").change(function(){
    var view = $(".view select").val(); //assuming that View and Time are a Dropdown, if they are single line then replace select with input
    var time = $(".time select").val();    

   $(".time select").val("");
  });

 

0 0

Replies

replied on October 18, 2018

Thank you for your response.  This works great. 

0 0
replied on October 19, 2018

Glad I can help - if this answered your question please mark my reply as the Answer to your question. Thanks!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.