Jump to content


Caspio Guru
  • Content Count

  • Joined

  • Last visited

  • Days Won


DesiLogi last won the day on September 29

DesiLogi had the most liked content!

1 Follower

About DesiLogi

  • Rank
    Advanced Member

Recent Profile Visitors

1,744 profile views
  1. ah, now I see you can't close a window with js unless it's been opened with js. Thanks for the link Kristina!
  2. Hi, My app is very image intensive and I have the user sometimes upload images to CB the normal way (in a File type field from a Submission form) and sometimes the image path/url will come from an S3 Bucket and be stored in a Text255 field. The goal is to have all image paths stored in a single field, whether uploaded by the user to CB or brought from an S3 bucket, and then use that field's file path to display images (because I often copy records and a FileType field cannot be copied without a special trigger set up by Caspio's DevOps, so I use a Text255 field for the image path). I can get the CB image path from the File Type field into a Text255 path, along with the S3 image paths (via formula). So that's done and I now have a single field with image file paths from either CB Upload or S3. The issue is displaying them: S3 images are fine but I can't get the images in CB to display. Neither <img src="[@field:Image_Text255_Field!]"/> or <img src="[@field:Image_Text255_Field/]"/> works if the image is stored in the CB account. Is there a way to reference images in CB from a text255 field to display them? I'd thought it would work the same as referencing a S3 image because it's just a file path and the image in CB is obviously available. Thanks for any help on this--
  3. Ah, I see what happened. The demo datapage I'd uploaded to this thread I'd set up separately and spelled the fields differently (with an 's') but the code I'd pasted into it was from my production datapage. On the production datapage the field spellings match up and it still doesn't work. Sorry about that confusion. Still not sure why I can't get it to save all 3 selected choices. EDIT: Hi Vitaliksssss, Ok, I got it now. Your code does work perfectly after all. The issue is that I had a Rule to show/hide the listboxes (so the user has a cleaner UI). So when they user selects records in the first listbox and uses a Virtual field Radio Button to hide it and show the 2nd listbox, it does 'save' the 1st listboxes selections in that they are highlighted, but upon Submission it does not save that listbox's choices if it's been hidden. So essentially the code works great, the problem is show/hiding the listboxes and retaining the values selected in all listboxes. Is there anyway to deal with that or is it necessary to just keep all the listboxe's visible (cluttered though they'll be). That said, many thanks for your help and digging through this with me- much appreciated.
  4. Ah, I see what happened. The demo datapage I'd uploaded to this thread I'd set up separately and spelled the fields differently (with an 's') but the code I'd pasted into it was from my production datapage. On the production datapage the field spellings match up and it still doesn't work. Sorry about that confusion. Still not sure why I can't get it to save all 3 selected choices.
  5. Hi Vitalikssssss, That is a really nice solution and works great! Thanks very much for posting this, I'd never thought of trying to do it that way.
  6. Hi Vitaliksssss, Thanks very much for offering to take a look at the datapage. Unfortunately I can't attach a file to a private msg on this forum so I made stripped down copy of the datapage and its dependancies to post here. In the meantime I'll give your attached version a shot. Very much appreciate your looking into it! CaspioData_2019-Oct-02_0008.zip Ah, I see part of the problem- when I looked at your example datapage I see that it's a Details page, and therefore the code has 'edit' for the the function. My datapage is a Submission datapage so it needs to have 'insert' instead. I changed it to 'insert' and it allows to multi-select records in the Listboxes. However, it only saves the last Listboxes selections. So if the user selects values in the 1st listbox, goes to the 2nd listbox and selects some values there, then goes to the 3rd listbox and selects multiple values, on Submit it will only save the 3rd listboxes values to the new record. This is odd because the 1st and 2nd listboxes still show the highlighted records before Submission. Not sure what's going on with that.
  7. Hi Vitaliksssss, Thanks for the help with this, very much appreciated. I'm not sure if I have this right, though. I put the field names in the section: let v_state = ["Tags", "Tag_Areas", "Tag_Projects"]; //Field names goes here but now it's not letting me select multiple values for any of those listboxes. The code doesn't look like it should be: let v_state = ["[@field:Tags]", "[@field:Tag_Areas]", "[@field:Tag_Projects]"]; so I'm not sure where to look. Normally, on a Mac, you have to hold down the Command key to multi-select. Is there some other method to do that with this code?
  8. Hi Vitalikssssss, Thanks for this code- it does as you say and puts the comma delimited values of the text field into a Listbox- very nice. The issue for me is that I'm storing the ID values (integers) as the comma delimited multiple values but I need to show the related text value (from another table) in the Listbox. So there's a lookup involved (which you can do in the Details field's field when setting it to Listbox). So basically, if the values I have in the field are something like 2, 3, 34 I need to be able to lookup in myLookupTable where, as separate records, "text field value for the record with ID = 2 ", "text field value for the record with ID = 3 ", "text field value for the record with ID = 34 " and then show those text values in the Listbox you've shown how to create. I apologize if I wasn't fully clear on what the multiple values stand for, I should've delineated that in the original post.
  9. I've got 3 fields set as Listboxes on a Submit datapage. I'm using js to select multiple records and enter them comma delimited upon submission. The code works fine when doing it with one Listbox but I can't figure out how to get it to work for all three. Right now I'm just repeating the code for each listbox (with a different variable name for each) but it doesn't work. I imagine there's a more unified way to do this so the code covers all 3 Listboxes. Anyone have any ideas? Here's the code so far (it's obviously wrong to repeat the entire script 3 times, I just don't know how to unify it): <script type="text/javascript"> var v_state = "[@field:Field1]" ; var o_state = document.getElementById("InsertRecordField1") ; 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 ; } } } } } //window.onload = f_listbox ; document.addEventListener('DataPageReady', f_listbox()); </script> <script type="text/javascript"> var v_state2 = "[@field:Field2]" ; var o_state2 = document.getElementById("InsertRecordField2") ; o_state2.multiple = true ; function f_listbox2() { if ( v_state2.indexOf(",") > 0 ) { for (var i2=0 ; i2 < o_state2.options.length; i2++ ) { if(o_state2[i2].value == v_state2) { o_state2.remove(i2); break ; } } var o_st2 = v_state2.split(", ") ; for (var j2=0 ; j2 < o_st2.length; j2++) { for (var i2=0 ; i2 < o_state2.options.length; i2++ ) { if(o_st2[j2]== o_state2.options[i2].value){ o_state2.options[i2].selected = true ; break ; } } } } } //window.onload = f_listbox2 ; document.addEventListener('DataPageReady', f_listbox2()); </script> <script type="text/javascript"> var v_state3 = "[@field:Field3]" ; var o_state3 = document.getElementById("InsertRecordField3") ; o_state3.multiple = true ; function f_listbox3() { if ( v_state3.indexOf(",") > 0 ) { for (var i3=0 ; i3 < o_state3.options.length; i3++ ) { if(o_state3[i3].value == v_state3) { o_state3.remove(i3); break ; } } var o_st3 = v_state3.split(", ") ; for (var j3=0 ; j3 < o_st3.length; j3++) { for (var i3=0 ; i3 < o_state3.options.length; i3++ ) { if(o_st3[j3]== o_state3.options[i3].value){ o_state3.options[i3].selected = true ; break ; } } } } } //window.onload = f_listbox3 ; document.addEventListener('DataPageReady', f_listbox3()); </script>
  10. Hi MayMusic, Thanks for posting the script for updating a dropdown without refreshing the whole page. That's a key thing for a smooth UI. I need to use this method to update a multi-select Listbox field (instead of a drop down field) and I can't get it to work. I tried using getElementsByName("InsertRecordFieldName")[0] instead of getElementById("InsertRecordFieldName") but it's not refreshing the field listbox. Any idea how to target a Listbox for refresh in this scenario? EDIT: actually, I did get this to work using getElementsByName("InsertRecordFieldName")[0] . What was missing was I needed to use the parameter from the popup in the OnLoad in the Listbox field. Works great now- thanks for posting that javascript, really helpful.
  11. I need to show a listbox in a Gallery datapage, next to some other data about the record. Each record will be 'assigned' to multiple projects (as values in a text field, comma delimited) and I need to show the list of them at a glance, in the Results section. It's not a problem to show this in Details but I can't figure out how to do it in a Gallery's results, as Listbox is not a display option for a field.
  12. Hello, I was hoping at some point soon Caspio would enable Lookup tables/views in ListBox type fields so the user could create their own choices for the Listbox (instead of it being hard-typed in in the table Design for that Listbox field). It's been awhile though and I can't wait any longer- so I'm using the older method of js and a text field to store multiple values comma delimited. This works fine except I don't have a way to show the related text values to the stored numerical values in a Tabular or Gallery datapage. This is because the field (text255) only has the option for Text, html, email, url link in a Tabular/Gallery datapage. Multiple values can be shown for a text field on a Details page using js and a ListBox type display. Is there any way to utilize something similar for a Tabular/Gallery datapage? I even tried using a trigger to push those multiple values from the text255 field into a Listbox field (because you can display a Listbox type field in a Gallery datapage) but the trigger won't allow updating into Listbox fields. This is frustrating- having dynamic lookups for Listbox fields would solve this issue entirely.
  13. Hi Vitalikssssss , thanks for the suggestion. Was thinking about that but an alert is a popup and a little raw looking. I'd wanted to put something a bit more polished on the page itself, with more text. I used the word "success" to shorten this question but would need to put a detailed message in reality. I'll play around with the alert in the meantime. Thanks again for your help on this thread (and others).
  14. Hi vitalikssssss, thanks for the help on this. This is a good way to do it, if I notify the user to enable popups for my site. I didn't know how your code would integrate with the existing code I'm using to parse a virtual field value so I just tried putting in the window.open clause without the timer or EventListener and it seems to work. The last question I have is, how do you put a message like "Success" to show in the background while the page is updating after submission. Even without the timer the datapage refreshes for about 2-3 seconds before it goes to URL 1 and opens URL 2 in a new tab. During that time it's just white space and the user might be confused about what's happening. I'd like to show a message like "Success" during that refresh, if possible. Is that doable within this code? If not I'll just leave it as it is since it seems to work. Thanks again for your insight. The code I have right now, in the Destination section is: <script> var v_virt = "[@cbParamVirtual5]"; //if Add More button is clicked, load the same form if(v_virt=="AddMore"){ window.location.href = 'mysamepage'; } if(v_virt=="SaveClose"){ window.location.href = '../mynewpage'; } if(v_virt=="SaveBuy"){ window.open('[@field:Second_URL]'); window.location.href = '[@field:First_URL]'; } </script>
  15. Hello, I have some js in the Destination part of a submission form, for after the Submit happens (I do this in js because there are 3 different sets of options to go to after submission, depending on what the user selected in the submission fields). I'm using window.location instead of window.open because of popup restrictions. I need to do 2 things on form submission: 1) have the existing window go to a url with parameters like a normal Caspio form can do and 2) open a different url in a new tab. So basically, the user clicks Submit, the existing window refreshes to a new page and a new tab opens to a different url. Is this possible? Something like: window.location.href = '[@field:First_URL]'; window.location.href = '[@field:Second_URL]', '_blank'; I don't know how to get it to run the code for the 2nd url before it updates to the first, as well as get the 2nd url to open a new tab.
  • Create New...