The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Reload form and update dropdown list after modal entry
I have a form with a dropdown that a user selects to categorize the form entry. There are times that the user will need to add additional categories to the list if they are not present. It would be helpful if the user could open a modal window to the category form to add another category to the list. Once they submit the entry in the modal form the dropdown list will refresh. I am not sure how this affects the parent form if the user has already entered data in the parent form. I am not sure if the dropdown list can update without affecting the parent form's entry. Possible fix, save parent form as a draft while refreshing dropdown list.
I did find a forum post with another user explaining a similar situation. They did post some code, but I am not sure if it is the entire code to solve this problem or where to even place the code. Here is the code below.
function getAjaxVariable(variable){var query = variable;var vars = query.split("&");for (var i=0;i<vars.length;i++) {var pair = vars[i].split("=");if(pair[0] == "value"){return pair[1];}}return(false);}jQuery(document).ready(function($){$( document ).ajaxComplete(function( event,request, settings ) {var query = settings.data;if(query != undefined) {var res=getAjaxVariable(query);if(res=="Deposit+Paid" || res=="Enquiry" || res=="Booked" || res=="Balance+Paid" || res=="Pending" || res=="Cancelled"){location.reload();}}});});</script>
January 1, 2018 at 10:06 pm
I'm asking the same question today Jan 1st, could you provide the other forum post to check if they found a solution?
I've thought of using an embedded form, in your case, embedding the categories form in your main window with a conditional hiding to display the embbeded form, but the problem is this is not an elegant solution because you should submit the main form to get the category added. Then we have to add a hook to separate the child entry from the one created from the main form.
I know what you want here. Besides the category selection, a + sign opens a modal window and you can add the category and submit. Then you return to the unfinished form and the new category now is in the dropdown to be selected.
Please someone would enlight about this?
Discussion closed.