Jump to content

Elderberg

Caspio Ninja
  • Content Count

    51
  • Joined

  • Last visited

About Elderberg

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, i've selected Custom option using Totals and Aggregation.. how do I use the Custom option to do summation?
  2. Excellent. thank you. I will give this a try next time. I ended up renaming my fields, it wasn't as time consuming as I thought, but will look into what you've shared in future scenarios.
  3. Hi, See below the code which i've used on a web form submission successfully. I've tested this on the Details page, it seems to work, however, the changes made on the Details page don't get written to the database table. Any advise welcome.. <script> // PREVENT SUBMIT UNLESS VALIDATED document.addEventListener('BeforeFormSubmit', function(event) { event.preventDefault(); //do something before submitting update document.forms["caspioform"].submit(); }); </script>
  4. www.example.com/datapage.asp?cid=D4ITUH2C Is it possible to directly reference the cid value using Javascript?
  5. For benefit of others, the following code works better: // PREVENT SUBMIT UNLESS VALIDATED document.addEventListener('BeforeFormSubmit', function(event) { if (some_condition) { //result if condition is met } else { event.preventDefault() } });
  6. I resolved a way to trigger an onchange event on Field1 programmatically. Once the onchange event is triggered the cascading dropdown refreshes properly. var e = document.querySelector("[id*=cbParamVirtual40]"); e.dispatchEvent(new Event('change'));
  7. I've isolated it to the javascript below which I've used successfully in other datapages. I've stripped away my code and run the form with the below code verbatim. (i.e. the if statement i changed the condition to be "1") and ran the code and experienced the weird issue. I'm totally stumped. <script type="text/javascript"> // PREVENT SUBMIT UNLESS VALIDATED document.addEventListener('BeforeFormSubmit', function(event) { event.preventDefault(); // checks validation rules, only submits if all rules are validated successfully. if (1) { document.forms["caspioform"].submit(); } }); </script>
  8. Upon successful submission I have a message displaying "Your record was successfully updated." However, for some reason now the submission form is repeated below this after successful submission. I notice after the submission the URL has this: ?appSession=8RB87A2G927E83NL92A4 ... I'm not sure why this appSession key is appended to the URL but it seems to be causing the issue. Does anyone have any idea what's going on or tips on where I should start troubleshooting? I tried to check a few places when I edit the datapage but didnt see anything out of the ordinary.
  9. I'm having trouble getting a cascading dropdown to refresh programatically : I have two fields: Field1 (dropdown) and Field2(cascading dropdown), when the page loads I can using javascript set the value of Field1, but the corresponding Field2 does not recalculate. its always stuck filtering off the first item in the Field1 dropdown.
  10. FYI, for benefit of others with similar problem that want to use a single page with the search criteria displayed above the Results. //insert script below into Footer of "Configure Search Fields" <script> document.addEventListener('DataPageReady', function (event) { // Create a new Virtual Field (in my case cbParamVirtual1) for user to enter the search parameter. // The below code will execute when the user updates the Virtual Field and then stamp it into multiple fields. var x10 = document.querySelector('[id=cbParamVirtual1]'); x10.onchange = function() { document.getElementById('Value1_1').value = document.getElementById('cbParamVirtual1').value; document.getElementById('Value2_1').value = document.getElementById('cbParamVirtual1').value; document.getElementById('Value3_1').value = document.getElementById('cbParamVirtual1').value; } }) </script> Also you'll need to edit items under the Logic tab as follows: After you test, you can hide the fields: Value1_1, Value2_1, etc
  11. Thanks Vitaliksssss. however, is there a way to capture and reference the alphanumeric key that's appended? I have a use case where i'm using the following fields in my table: - fno1_paytype - fno1_Start_Time - fno1_End_Time - fno1 I'm having trouble accessing fno1 because document.querySelector("[id*=InsertRecordfno1_]"); isn't catching the correct field Ultimately I may have to rename fields, but since I have a lot of javascript, as well as multiple datapages already built and working which references the above table fields, renaming would be a worst case scenario.
  12. Inspecting the webpage I see that caspio in some cases appends an alphanumeric code to a virtual field ex: cbParamVirtual23_5cc2f7c259e4b5 I've read and used fairly successfully the following to reference the value: document.querySelector('[id*=cbParamVirtual23]'); My question: is there a more explicit way to reference this virtual field? Reason being the asterisk is a wildcard and it gets messy when referencing cbParamVirtual2 if there is a cbParamVirtual23 present prior.
  13. Hi, this might be a bit advanced.. If i'm using a SubmissionForm Datapage i would be able to use the following to retrieve the value of a field: var Flag = document.getElementById('UpdateRecordYesNo').value; but i'm using a Tabular Report Datapage paired with a HTML Block . I'm trying to get the value of [@field:YesNo] and assign it to a variable called Flag. Can someone help me with the correct syntax to reference a field associated with the current row of a tabular datapage? <div id="mydiv[@field:CMP_ID2]"> </div> <SCRIPT LANGUAGE="JavaScript"> var Flag = [@field:YesNo^] if ( Flag = 1){ document.getElementById("mydiv[@field:CMP_ID2]").innerHTML = "X" ; } else{ document.getElementById("mydiv[@field:CMP_ID2]").innerHTML = "Y" ; } </SCRIPT>
  14. Hi There,I'm using a Chart Datapage and in the search footer I have the following which i'm testing something weird.<script>document.addEventListener('DataPageReady', function (event) {alert("Hello World");});</script>The hello world executes 3 times upon loading.. Can someone advise i I would be able to limit the execution to run just once?
  15. Solution Involves 2 Parts: Part 1: You need to use setTimeout() method to delay the code such that it runs AFTER the calculated fields get computed. See https://www.w3schools.com/jsref/met_win_settimeout.asp Part 2: You need to reference calculated fields using the document.getElementsByName with index 0 instead of by ID, this is because caspio adds some alphanumeric codes after the Virtual Parameters ID when its set to a Calculated Field. See Code: var x = document.getElementsByName("cbParamVirtual27")[0].value; document.getElementById("ElderbergHTMLBlock1").innerHTML = x;
×
×
  • Create New...