Jump to content

Elderberg

Caspio Ninja
  • Content Count

    39
  • 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, 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>
  2. 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?
  3. 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;
  4. hmm, I think my code is running before the calculated field executes based on some tests I did. Is there a way to wait until Virtual Fields are calculated? I tried this unsuccessfully: document.addEventListener('DataPageReady', function (event) { });
  5. I'm wondering if its possible to run an SQL Select Statement within footer instead of as a calculated field.
  6. Please bear with me as i try to unfold this. I have a submission datapage with a Virtual Field (Virtual23) where as a Calculated Field i'm using a SELECT statement to fetch what I need correctly. This is successful. Where i'm struggling is how to reference this value in javascript. I'm trying to store the value in a varable ... I've tried this: var x = document.getElementById("cbParamVirtual23").value; and it doesn't seem to work. I'm assuming the value fetched by the SELECT statement should return a string. I've tried the below code to test if it works, but it fails. document.getElementById("ElderbergHTMLBlock1").innerHTML = x; document.getElementById("ElderbergHTMLBlock1").innerHTML = x.toString();
  7. I realize the Task creates the dates as a Date Object.. i think i need it to be saved as a String. I was unsuccessful in my attempt to modify your Task. Can you advise if this is possible?
  8. Hey Vitalikssssss, I implemented your suggestion using a Dropdown box. Previously I had a VirtualField configured as a TextField with calendar pop up enabled. Below are two lines of code which i used previously when the field was a TextField. Can you advise how I would 1.) assign v_DateOnlyStamp as a value to the dropbox 2.) pass the selected value of the dropbox to a variable. // Assign Current Date document.getElementById('cbParamVirtual1').value=v_DateOnlyStamp; // pass value to variable var date = document.getElementById('cbParamVirtual1').value;
  9. Good Stuff, i changed timestamp to date and got it to work. Its an interesting work around which i'll consider. it solves one challenge and creates others. but thank you kindly.
  10. I'm looking for javascript sample that would allow me to restrict my users to only be able to select between yesterdays, current date, and tomorrows date when using the calendar popup.
  11. Hey Manon, See below where I used a Calculated Value to "copy" the value of a dropdown into a field. with regards to the javascript above, just place that into the footer like kpcollier mentions.
  12. Hi All, I've followed along and got it to work, However I've tested using: 1. cbParamVirutal1 as a Text_Field with calendar option and this was Successful (Note this is as per the example posted above) 2. cbParamVirutal1 as a Hidden_Field with default value and this was Successful cbParamVirutal1 as a Display_Only_Field with default value and this was Unsuccessful cbParamVirutal1 as a Calculated_Value_Field which returns as a text with value 01/01/2011 and this was Unsuccessful var date = document.getElementById('cbParamVirtual1').value; I'm trying to get it working with a Calculated Value, so i can calculate the date automatically and not allow the user to change it. For the curious, below is the code i've used in Calculated_Value_Field (which uses SysDateTime() and the Month() Day() and Year() functions to re-create the date in a mm/dd/yyyy format): CONVERT(VARCHAR(10), Month(SysDateTime() ) ) + '/' + CONVERT(VARCHAR(10), Day(SysDateTime() ) ) + '/' + CONVERT(VARCHAR(10), Year(SysDateTime() ) )
  13. Ah what a brilliant suggestion! thanks. it was right there starring at me the whole time.
  14. Is it possible to pass an external parameter and receive it in a virtual field? At this moment I can only receive an external parameter into a field that exists as a column in my table, but i don't want to add extra columns to my table unnecessarily. Can someone advise if its possible to receive into a virtual field set to Calculated Field?
  15. Update #2: I tried to set the textbox to be non-editable, so that in grid edit mode the users wont be able to make changes, but this breaks the above solution. So the "Default Value for Inline Edit" is a bit experimental and should be used with caution.
×
×
  • Create New...