Jump to content

DesiLogi

Caspio Rockstar
  • Posts

    293
  • Joined

  • Last visited

  • Days Won

    22

DesiLogi last won the day on March 18

DesiLogi had the most liked content!

Recent Profile Visitors

2,548 profile views

DesiLogi's Achievements

  1. Unfortunately I don't as there's a lot of other stuff going on. I'll see on Monday if I can create a stripped down version to post--that's a really good idea.
  2. I did try that, along with every permutation I could think of. Must be some minor difference but key..
  3. Hi, the below code is used to create comma-delimited text values (in a text255 field) so the user can select multiple values in a list box and save them (separated by commas) in a text field. It's necessary to use this method instead of the Caspio-native 'List' data type because the lookup values need to be dynamic (I wish Caspio would enable this, been waiting FOREVER). This method works great for Details and Update datapages but I need it to also work in a Bulk Edit page. I've tried changing 'EditRecord' to 'BulkEditRecord' but it doesn't work. Does anyone know how to modify this code to work in a Bulk Edit page? This is so the user can select multiple records and update them with multiple selections in a listbox. <script type="text/javascript"> var v_state = "[@field:state]" ; var o_state = document.getElementById("EditRecordstate") ; o_state.multiple = true ; function f_listbox() { if ( v_state.indexOf(",") > 0 ) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_state[i].value == v_state) { o_state.remove(i); break ; } } var o_st = v_state.split(", ") ; for (var j=0 ; j < o_st.length; j++) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_st[j]== o_state.options[i].value){ o_state.options[i].selected = true ; break ; } } } } } document.addEventListener('DataPageReady', f_listbox); //You can also use the line below instead of the eventlistener // setTimeout(f_listbox, 20); </script>
  4. 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.
  5. 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!
  6. 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>
  7. 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?
  8. 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.).
  9. 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!
  10. 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>
  11. 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?
  12. @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-
  13. 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!
  14. 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>
  15. 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>
×
×
  • Create New...