Jump to content

DesiLogi

Caspio Rockstar
  • Posts

    290
  • Joined

  • Last visited

  • Days Won

    22

DesiLogi last won the day on March 18

DesiLogi had the most liked content!

Recent Profile Visitors

2,480 profile views

DesiLogi's Achievements

  1. Yeah, I know re the API and that wouldn't work. What would work is if you could call a function from a table's trigger--that would open up all kinds of possibilities. I was hoping someone had figured out a workaround.
  2. Hi, Part of my app is a chat/messaging module that enables users in the same account (it's a SaaS app where each customer might have multiple authenticated users in the same account) to 'chat' or message each other. Everything is good on it except I need to figure out how to show a popup notification to the user who a message is directed to, instantaneously, so they know they have one. I don't mean using the email or text message triggers (already have that enabled) but showing a small 'you have a new message' message in the lower right of the web page the app is hosted on. I've used sliding panels, fancybox, and straight popups in other areas so I imagine I can configure one of those methods to show the notification and new message content. The problem I'm having is, how do you trigger a function to open a notification popup/panel in another user's account, on a different computer entirely? So when User1 submits a new message directed to User2, User2 will get an instant notification in their own browser? I imagine it's some sort of listener setup but don't really know how it would work. If anyone has any suggestions that'd be great!
  3. I found the right answer to select the field to be Bulk Edited, as well as put a value in the field. You have to reference the check box for that field. Here's the full code in case anyone needs it: <SCRIPT LANGUAGE="JavaScript"> /* Declaration and initialization */ Stamp = new Date(); var v_TimeStamp; Hours = Stamp.getHours() Mins = Stamp.getMinutes(); /* Attach a prefix with digit '0' if the minutes is less than 10. */ if (Mins < 10) { Mins = "0" + Mins; } /* Construct the value of the v_TimeStamp variable in the format m/d/yyyy hh:mm */ v_TimeStamp=('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate() + "/"+Stamp.getFullYear() + ' ' + Hours + ":" + Mins); /* Field name - Date_Charge is referred with a prefix - EditRecord */ document.getElementById("BulkEditComments_Actual_Read_Date").value = v_TimeStamp; var checkboxName = "Enable"+ "BulkEditComments_Actual_Read_Date" + "Ckb"; document.getElementsByName(checkboxName )[0].checked=true; </SCRIPT>
  4. Hi, I'm trying to use js to get the user's system date/time on their local computer, in the Bulk Edit section of a tabular datapage. I've used this code in various other datapage types but cannot get it to work in the Bulk Edit footer. In the footer of Bulk Edit, the field is Comments_Actual_Read_Date but it's not capturing the v_TimeStamp value. Does Bulk Edit need something besides EditRecord to reference a field? Here's the code I've got: <SCRIPT LANGUAGE="JavaScript"> /* Declaration and initialization */ Stamp = new Date(); var v_TimeStamp; Hours = Stamp.getHours() Mins = Stamp.getMinutes(); /* Attach a prefix with digit '0' if the minutes is less than 10. */ if (Mins < 10) { Mins = "0" + Mins; } /* Construct the value of the v_TimeStamp variable in the format m/d/yyyy hh:mm */ v_TimeStamp=('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate() + "/"+Stamp.getFullYear() + ' ' + Hours + ":" + Mins); /* Field name - Date_Charge is referred with a prefix - EditRecord */ document.getElementById("EditRecordComments_Actual_Read_Date").value = v_TimeStamp; </SCRIPT> EDIT: Ah, I found a post showing you use 'BulkEdit' instead of 'EditRecord' but now the issue is if js is used to populate the Bulk Edit field it doesn't check the left column 'select' box automatically so the user has to do it manually. This defeats the purpose and is clunky. Is there a way to 'select' the field in Bulk Edit using js?
  5. Whenever I need something that happens in a Caspio datapage to 'exit' the datapage and do something on the host page I do it via calling a js function that affects the host page. For example, on the dropdown's 'change' you can call a js function (which can be located on the host page in script), and that function can do something like shows/hide a divs on the host page. So if you have images in divs on the host page, using an id for each div, you can show/hide the div's id, depending on the value of the Caspio dropdown (which runs an onChange event to get the value, which then runs a specific function on the host page. This is a general answer as there are many ways to do it, but basically a) use onChange script in the datapage to read the new dropdown's value b) depending on that value call a js function c) that function can be in script on the host page and can then do anything you want on that page (show/hide divs, etc.).
  6. Hi, I'm trying to use the code below in the footer of a tabular report results section for the 'Inline Add New Record' can use it. The js is code to get the user's computer date/time (not the localization or CB system) and put it in a date/time field. I use this code in submission forms with no issues but don't know how to reference it correctly for a tabular inline add new record. If someone knows how to mod this I'd really appreciate it. <SCRIPT LANGUAGE="JavaScript"> /* Declaration and initialization */ Stamp = new Date(); var v_TimeStamp; Hours = Stamp.getHours() Mins = Stamp.getMinutes(); Secs = Stamp.getSeconds(); /* Attach a prefix with digit '0' if the minutes is less than 10. */ if (Mins < 10) { Mins = "0" + Mins; } /* Construct the value of the v_TimeStamp variable in the format m/d/yyyy hh:mm */ v_TimeStamp=('' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+Stamp.getFullYear() + ' ' + Hours + ":" + Mins + ":" + Secs); document.getElementById("InsertRecordComments_Actual_Submission_Date").value=v_TimeStamp; </SCRIPT> EDIT: just found the solution right after posting this. In case anyone needs it, tabular inline add uses 'InlineAdd' instead of 'InsertRecord'. Wish everything was so easy!
  7. Hmmn, that's odd--I'll have to test it without the function. Basically, f_copy_print_address is used to copy the value of the Virtual drop down into the Text Area box. It's something Caspio set up several years ago for me to copy Text64000 values (addresses, at the time) that I've used for other Text Area copying. Not sure why it would hang the whole thing up but I'll do some tests to see, and perhaps there's a better way to copy the value to the Text Area. Thanks for pointing that out. EDIT: On testing it seems like the issue is that, for the warning message to run, you have to manually type something into the box. If the formula runs and pastes in some data via js then it doesn't 'register' the next time the onChange runs so v_spec won't be != "" and therefore no warning message. Last edit: the code below is what I ended up using and it works well, even though the js pasted data isn't registered a v_spec. This is because in this particular use I only need the warning to show if the user has actually typed something in. If the user just switches templates (values in the Virtual dropdown) it doesn't matter if what's there is overwritten, so there's no need for a warning message in those cases. Here's the code, if anyone else needs this and thanks, TellMeWhy, for taking a look. <script> $("[name='cbParamVirtual20']").change(function(){ var v_spec= document.getElementById("InsertRecordExtraDescriptionSpec").value; if(v_spec != "") { var retVal = confirm("Any data in the Specs box will be overwritten. Do you want to change templates?"); if (retVal == true) { f_copy_print_address('cbParamVirtual20', 'cke_InsertRecordExtraDescriptionSpec'); return true; } else { return false; } } if(v_spec == "") { f_copy_print_address('cbParamVirtual20', 'cke_InsertRecordExtraDescriptionSpec'); } }); </script>
  8. Hello, In a Submission form I've got js running on a Virtual field dropdown, OnChange, that updates a Text Area field (using a formula). The user may use this Virtual dropdown and update the Text Area, type some more data into it, and then change their mind and choose another option from the Virtual field drop down, which would run the onChange code again. I need is to put up a warning message with Cancel to let the user know the data already in the Text Area field will be overwritten if they choose OK. The issue is I don't want the message to show if the Text Area is blank (like when the form is first opened) because there's no data to be overwritten and the warning would be an annoyance. So the code needs to, when the Virtual Dropdown is changes, check to see if the Text Area field has any data or not. But I can't seem to reference the Text Area field's value after it's been updated by the js. Basically, the js needs to check to see if there's a value in the Text Area and, if so, run the warning. If there's no value then just run the formula. <script> $("[name='cbParamVirtual20']").change(function(){ var v_spec= document.getElementById("InsertRecordExtraDescriptionSpec").value; if(v_spec != "") { var retVal = confirm("Any data in the Specs box will be overwritten. Do you want to change templates?"); if (retVal == true) { f_copy_print_address('cbParamVirtual20', 'cke_InsertRecordExtraDescriptionSpec'); return true; } else { return false; } } if(v_spec == "") { f_copy_print_address('cbParamVirtual21', 'cke_InsertRecordExtraDescriptionSpec'); } }); </script> It seems like the line var v_spec= document.getElementById("InsertRecordExtraDescriptionSpec").value; isn't getting the current value if the user has already run this function. Any ideas on how this could be fixed?
  9. @kpcollierIt's been awhile since I posted this but I believe the issue can be fixed in the Tables Relationships view. When you create a relationship with a table it allows you to choose a display value instead of the Id. When you use that field in an inline edit datapage it will then use the display field for the user (while storing the id field) when editing. See the screenshot. Hope this helps-
  10. I just found this suggestion--this is ace! I hadn't thought of this workaround and it solves the very poor 'hourly' limit on Tasks. Thanks for posting PrinceZuko!
  11. Ok, after trying tons of stuff I finally came up with the answer, in case anybody needs to pull tabular, inline values from Caspio and use them in javascript. First, create a div with an id that uses the unique identify Caspio field: <div style="width:100%;text-align:right;" id='mydiva[@field:HProjectID]'></div> Then use some script with an EventListener to grap the current value in the div and use it as a parameter in some javascript. I have the js running in the a link. Whatever is in the div inside the EventListener function will show up in the above div. I use a calculated field for the 'label' because not all records need this link. If the record doesn't need it, the link doesn't show up and it keeps the results clean. This works really nicely. <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { document.querySelector("#mydiva[@field:HProjectID]").innerHTML =`<div style="width:100%;text-align:right;" > <a class="nou" style="font-size:13px;" href="#" onclick="document.getElementById('tracking').src = 'notify-actify/dash-notify?HProjectID=[@field:HProjectID]';">[@calcfield:4]</a> </div>`; }); </script>
  12. This code will run when the button is clicked (button id ="alertsbtn") and it will get the first value in the record set, and then cycle through all records. It doesn't get a value if the button in a record that's not the first is clicked. So it seems like this is fairly close to working, if someone can figure out the adjustment I'd really appreciate it. ** I have an alert box running to test the code, instead of the full code. <script type="text/javascript"> document.getElementById("alertsbtn").addEventListener("click", function(){ var isi = document.querySelector("#visi[@field:HProjectID]").innerHTML; var param_label = "?HProjectID="; var url_end = param_label + isi; alert(url_end); }); </script>
  13. Hi CooperBackpack, Many thanks for the code--I was thinking it would be something like using innerHTML but didn't know how to implement it. Now it will read a value for @field:HProjectID but it's giving the same number '3' for each record. So it seems like it's not catching each row's (record) individual HProjectID value. Am I missing something else? EDIT: it's odd because the <span> shows the correct HProjectID value so it is getting that. The issue is the variable 'isi' doesn't seem to be picking it up, instead pulling a random value '3'. 2nd EDIT: I think the answer lies somewhere with using addEventListener (see below- I'm using an alert box to test it). When this code is put in the html block it will, on datapage open, cycle through every HProjectID and show them in an alert box --correctly. So it's getting the right values. Now I just need to figure out how to run this code ONLY when the button/link is clicked. I've tried putting "function ifrtrack" in various parts of this code but so far can't get it to work. If there's a way to run this code ONLY when the button with onclick="ifrtrack" is clicked I think that would complete the issue. <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { var isi = document.querySelector("#visi[@field:HProjectID]").innerHTML; var param_label = "?HProjectID="; var url_end = param_label + isi; alert(url_end); }); </script>
  14. Hi, Does anyone know how, in a tabular datapage's results, to get a record's value and use it as a parameter in a javascript function that sets the source for an iframe on the host page? I have a link/button to run a js function in an html block in the tabular results (meaning each record has that link, so if there's 20 records there's 20 of the same links/buttons, one in each row): <input class="buttonlink" type="button" onclick="ifrtrack()" value="Reports" /> I have this code in the datapage's footer. It resets the source for an iframe (id="tracking") on the host page. This function is run when the user clicks the above link/button in a record's html block. <script> function ifrtrack() { document.getElementById('tracking').src = 'notify-actify/dash-notify'; } </script> The issue is that each record in the results has a specific ID value I need to pass as a parameter for the iframe source link. Meaning instead of .src = 'notify-actify/dash-notify' I need to have .src = 'notify-actify/dash-notify?HProjectID=[@field:HProjectID]'. The problem is that each record in the tabular results will have a different, unique 'HProjectID' value. One record might have HProjectID=8 (so the iframe source url would be 'notify-actify/dash-notify?HProjectID=8') while another record in the results might have HProjectID=221 (so the iframe source url would be 'notify-actify/dash-notify?HProjectID=221'). Looking at it now, It seems like you would use an anchor ID and then run the js in the same html block (instead of in the footer). Something like: <a id="visi[@field:HProjectID]"> <script type="text/javascript"> function ifrtrack() { var isi = document.getElementById("visi[@field:HProjectID]"); var param_label = "?HProjectID="; var url_end = param_label + isi; document.getElementById('tracking').src = 'notify-actify/dash-notify' + url_end; } </script> But this isn't pulling the value for HProjectID. I tested it with an alert for the variable isi and it just shows up blank. Soooo... I don't know how to a) get the HProjectID value for the specific record/row the user clicks the link/button on and b) how to incorporate that into the js function as a parameter value at the end of the iframe source url. If anyone knows how to do this that'd be really great and thanks in advance-
  15. Hi LittleMsGinger, Thanks for the help with this. I did find the Current Week criteria and that does work well to bring up the current week. The problem is that the user might want to scroll before weeks and I think that locks you into the current week. If there's a way to have it open to the current week as per above but then be scrollable, by the week, to previous weeks, that's what I need. Thanks again for the help, though, much appreciated!
×
×
  • Create New...