Jump to content


  • Posts

  • Joined

  • Last visited

anyalynn's Achievements


Newbie (1/14)



  1. I have a script that works in my unpublished test application: <script> document.addEventListener('BeforeFormSubmit', function(event) { let checkValue = document.querySelector("select[id*='InsertRecordUWRadio']").value; if (checkValue == 'Yes') { let npiValue = document.querySelector("input[id*='InsertRecordNewNPI']").value; document.querySelector("input[id*='InsertRecordOrigNPI']").value=npiValue; } }); </script> UWRadio is a text field where I use a custom dropdown type with values "Yes" and "No" . NewNPI is a calculated field and OrigNPI is a required field that if the UWRadio is "No" must be filled in by the user. Then I put it in my real published application (field names are different), and it doesn't work. It will not get the values from the select list. <script> document.addEventListener('BeforeFormSubmit', function(event) { if (event.detail.appKey == 'xxxxxx') { //get the unique id for DOM element var elementID = event.detail.uniqueSuffix; let checkValue = document.querySelector("select[id*='InsertRecordCurrentUWStudent']").value; if (checkValue == 'Yes') { let npiValue = document.querySelector("input[id*='InsertRecordUWStudentNPI+elementID']").value; document.querySelector("input[id*='InsertRecordNPI']").value=npiValue; } } }); </script> When I look at the source, sometimes the ids have the elementID and sometimes not. It is all very confusing. Hopefully, I'm making a simple mistake.
  2. Unfortunately, this cannot be done with a table trigger because this table is updated by other datapages as well. I have a report that searches training dates, lists providers, and sets an indicator based on the fact that the provider took a training. The indicator can be set to yes for each provider with a bulk edit. An indicator date needs to be added when the indicator is set to yes. If this date is not added, I want it to default to the training date. It seems like it would be easy but I can't get the indicator date to save the training date value in the bulk edit if it is blank. There should be a way to take the training date from the results page, set the indicator date equal to that, and then if the user doesn't change that when setting the indicator in the bulk edit to yes/checked, it would save that training date in that indicator date field. I looked into doing this with a trigger, loading the training date into the indicator date field on load, using a placeholder, and JavaScript, but I can't get the value to save. If anyone has advice on how to do this, I would appreciate knowing about it. Thanks.
  3. My application has a provider table that contains name, email, phone, etc., which is linked to an address table so that the provider can have more than one physical address on file. Everything works fine, but I want to allow admins to delete addresses BUT require at least one address for each provider, so if there is more than one address they can delete, but when there is only one address they cannot delete anymore. The address table has a pointer to the ProviderID so that I know what addresses go with each provider, but I don't know if there is a query or a trigger that I can use with Caspio so that I can check that there is more than one address for a provider before I let an address be deleted. I hope this makes sense. Thanks in advance for any ideas.
  4. Because of the query, the default date is the same for all of the records, so it doesn't matter which one I copy. I just need to figure out how to get it in the Bulk Edit dialog.
  5. My datapage allows users to enter a new certification date with bulk edit, but I would like the default value to be the existing certification date which is in another field. I haven't figured out how to use JavaScript to get the value from the field in the results and use it as the default value for the new field in the bulk edit dialog (which can be changed). It seems like someone must have done this before. Thanks in advance for any replies.
  • Create New...