• Content count

  • Joined

  • Last visited

  1. Hi there, I've built a page that has a grid of images, allowing users to click on these images to make a selection ... and then I want these selections to all be saved to a table as separate entries along with their user information. So far, I can get only 1 selection to pass to the table. If they click on one of the images, that is sent to the table, fine. I've set it up so that each selection is added to the string, separated by a comma, but then this passes to the table as a single entry with the comma separated string. This is my code: function SelDatasource1() { document.getElementById("Datasource1").className = "SELECTED"; document.getElementById("InsertRecordDatasource").value += "Datasource1,"; document.getElementById("InsertRecordProject").value += "[@authfield:User_info_Project],"; document.getElementById("InsertRecordDatasource").multiple = true; } function SelDatasource2() { document.getElementById("Datasource2").className = "SELECTED"; document.getElementById("InsertRecordDatasource").value += "Datasource2,"; document.getElementById("InsertRecordProject").value += "[@authfield:User_info_Project],"; document.getElementById("InsertRecordDatasource").multiple = true; } ...etc etc ... there are over 30 of these. If somebody selects Datasource1, Datasource5, Datasource12, it shows up in the table like this: PROJECT DATASOURCE Project1,Project1,Project1 Datasource1,Datasource5,Datasource12 I am using a Submission form datapage at present, and have added my code using html blocks and footer. 2 things I need help on: 1. I know there is a better way to add a comma to the string, other than putting it in like this (i.e. value +="Datasource1,"). This way, a comma is added for a single entry and at the end of a long string, which I don't want to do - can anybody help me with this? 2. Can I pass this comma separated string so that it shows up in my table like this: PROJECT DATASOURCE Project1 Datasource1 Project1 Datasource5 Project1 Datasource12 Any help would be greatly appreciated! Many thanks Nikki
  2. Hi, I'm stuck on an issue and I'm hoping somebody will be able to help! What I have so far: a table named "Datasources" with a single line for each entry with 2 fields - project and datasource Each Project can have multiple datasources, so some projects may have 20 entries or some may have only 2 or 3, so the table looks like this: PROJECT DATASOURCE [ProjectA] [Datasource1] [ProjectA] [Datasource2] [ProjectA] [Datasource3] [ProjectB] [Datasource1] [ProjectB] [Datasource5] [ProjectB] [Datasource8] etc etc What I need to do: I would then like to set up a datapage, which is like a shop of sorts. It will display 20 different images relating to a library of items available for selection. These would be Datasources 1-20. I would like this page to display all of these logos, but show visually somehow if they have already been selected by that particular project in the Datasources table. So in the example above, when somebody from ProjectB views the table, they will see all 20 datasources, but only Datasource 1, 5 and 8 will be ticked. They then need to be able to select new ones should they wish. So they can click on the logos for Datasource 6, 9 and 10, and when they click the update button those 3 new entries will be passed to the Datasources table. When they refresh the page, Datasources 1,5,6,8,9,10 are all ticked. The issues I have are: How can I get the datapage to search every item in the table and show a different image (i.e. one with a tick overlayed) if that particular project has already selected that datasource? i.e. search table, IF project = ProjectA and Datasource = Datasource2 anywhere in the table, display image "datasource2-ticked". I don't want it to just search one line of the table, but the whole table. How can I get the page of logos to update multiple lines in the same table? i.e. Datasource1 image = "datasource1-grey" UNLESS it has already been selected, in which case image = "datasource1-ticked". Onclick image becomes "datasource1-colour" AND a new record is created with @Project in project column and Datasource1 in @Datasource column. And at the same time this can be done if multiple logos are selected, a new record is created for each one. Help! Many thanks Nikki
  3. Thanks for your reply! However this doesn't work. It's creating a text area and hiding the text field, which is fine, but my original dropdown isn't displaying, so the text area is empty. Any ideas? To clarify: My Datapage reads from the table "Cards" My dropdown is Virtual15 and reads from table "DataSources" (parent field in js) My cascading text field is Virtual16 and uses Virtual15 as parent field (virtual field in js) The text area I've created as part of the instructions is Virtual17 (text area in js) Hope you can help! Many thanks Nikki
  4. Hi there, Ideally I want to use a cascading text area, but apparently only a text field is available as a cascading element. I am using a virtual field and dropdown from lookup table to find the field I want in a table, and then I want to display a full text area from that table on my page (and possibly an image from that table too). Is this doable using javascript? I don't know how to access the correct table as my datapage is obviously linked to the wrong table. Many thanks Nikki
  5. OK, now got this after a bit more research, but still not working!!! Pleeease, anyone?? <script> var dropdown = document.getElementById("EditRecordExpected_Outcome"); var selectedValue = dropdown.options[dropdown.selectedIndex].text; if (selectedValue === "Business Insight") { document.getElementById("result").style.backgroundColor = "black"; } </script>
  6. I'm trying this but no good: <select id="EditRecordExpected_Outcome"> <option value="1">1</option> <option value="Business Insight">Business Insight</option> <option value="3">3</option> <option value="4">4</option> </select> <script> var dropdown = document.getElementById("EditRecordExpected_Outcome"); if (dropdown.value === "Business Insight") { document.getElementById("result").style.backgroundColor = "black"; } </script> <li><a data-toggle="tab" href="#menu4" id="result" style="background-color: #10368F; color: white;">5. TEST RESULT</a></li>
  7. Hi there, I have tabbed content on my page. One of which looks like this: <li><a data-toggle="tab" href="#menu4" style="background-color: #10368F; color: white;">5. TEST RESULT</a></li> I'd like to change the background color of this element to grey IF my dropdown (named [@Expected_Outcome]) equals Business Insight. I know I can probably figure this out, but my brain is turning to mush from looking at this and I have a deadline looming!! Can anyone help me write the correct script? Many thanks Nikki
  8. Hi, So I'd like a user to be able to enter a bunch of words, comma separated, in a submission form. And then another user to be able to select from that list in dropdown format in a report datapage. Any ideas? I'm stumped! Many thanks Nikki
  9. Hi there, Just wondering if anyone knows whether it's possible to drag items in a table to reorder them in Caspio datapages? I have a report datapage of a list of projects, and wish to be able to reposition each entry based on priority. Any thoughts? Many thanks Nikki
  10. Star ratings

    Thank you very much! I've now realised I need to do something else here ... is this possible? Is there a way to amend this code to check if QA_Tester_Rating has changed, and if so pass a timestamp as a parameter to a new field QA_Tester_Rating_Date? Many thanks!
  11. Star ratings

    No worries, I've done this too!
  12. Star ratings

    I've managed to get the rating to update back to the database thought I'd post in case anybody else finds it useful: <div id="el" class="c-rating"></div> <script src=""></script> <script> // target element var el = document.querySelector('#el'); // current rating, or initial rating var currentRating; if ([@field:QA_Tester_Rating#] > 0) { currentRating = [@field:QA_Tester_Rating#]; } else { currentRating = 0; } // max rating, i.e. number of stars you want var maxRating = 5; // callback to run after setting the rating var callback = function(rating) {document.getElementById("EditRecordQA_Tester_Rating").value=(rating); }; // rating instance var myRating = rating(el, currentRating, maxRating, callback); </script> Only thing that's not working is making the value 0 if the field is empty. So if the field in the table is empty (as it is by default) then the stars don't show at all. Can anyone help with this bit? // current rating, or initial rating var currentRating; if ([@field:QA_Tester_Rating#] > 0) { currentRating = [@field:QA_Tester_Rating#]; } else { currentRating = 0; } Many thanks!
  13. Hi there, I posted this over in the general forum last week, but have had no response so thought it would be better off here! I'm really stumped I'm trying to add a graphic star rating system to my site. I've found the following: which gets me about halfway there, but I just need some slight modifications! This is what I have in my datapage so far: <div id="el" class="c-rating"></div> <script src=""></script> <script> // target element var el = document.querySelector('#el'); // current rating, or initial rating var currentRating = [@field:QA_Tester_Rating#]; // max rating, i.e. number of stars you want var maxRating= 5; // callback to run after setting the rating var callback = function(rating) { alert(rating); }; // rating instance var myRating = rating(el, currentRating, maxRating, callback); </script> Where the field QA_Tester_Rating is the field in my table I want to read from and update using this system. At present, it reads from the field fine when there is something already in there, but if the field is blank, the stars don't show at all, so this is my first problem - I'd like the 5 stars to appear, empty, on the page when there is no rating yet. The second issue is that it's not updating my table. I tried adding something along these lines: document.getElementById("EditRecordQA_Tester_Rating").value=myRating; But my javascript is terrible and it obviously didn't work. Last issue, I would like to remove the popup alert when you change the rating. I thought it would be as simple as removing the bit that says: { alert(rating); } But that didn't work either! Any help you can give would be much appreciated! Nikki
  14. Star ratings

    Please, anyone??!!