Jump to content

lengleng

Members
  • Content Count

    18
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by lengleng

  1. 2 minutes ago, KweenYasmin said:

    Hi @TellMeWhy, I apologize for the late reply, and thank you for this script! It's working for me now, however, if you have time, how will this look like if say I have three dropdowns instead?

    Oh nevermind, I think I got it,

     

    <script>

    document.onchange = function() {
    var dropdown1 = document.getElementById('InsertRecordTitle');
    var dropdown1val = document.getElementById('InsertRecordTitle').value;

    var dropdown2 = document.getElementById("InsertRecordDescription");
    var dropdown2val = document.getElementById("InsertRecordDescription").value;

    var dropdown3 = document.getElementById("InsertRecordTEXT");
    var dropdown3val = document.getElementById("InsertRecordTEXT").value;

    for (var i=1; i<dropdown3.length; i++) {
        if (dropdown3.options[i].value == dropdown1val || dropdown3.options[i].value == dropdown2val){
            dropdown3.options[i].style.display = "none";
        }
        else {dropdown3.options[i].style.display = "block";}
    }


    for (var i=1; i<dropdown2.length; i++) {
        if (dropdown2.options[i].value == dropdown1val || dropdown2.options[i].value == dropdown3val){
            dropdown2.options[i].style.display = "none";
        }
        else {dropdown2.options[i].style.display = "block";}
    }

    for (var i=1; i<dropdown1.length; i++) {
        if (dropdown1.options[i].value == dropdown2val || dropdown1.options[i].value == dropdown3val ){
             dropdown1.options[i].style.display = "none";
           }
        else {dropdown1.options[i].style.display = "block";}
      

    }
    };

    </script>

     

    I just created another variable for the 3rd dropdown and set the if conditions with OR '||' so it will check the values of the 2 other dropdowns

  2. On 1/15/2021 at 9:50 AM, TellMeWhy said:

    I was just doing this recently!

    I'm not sure if there's a better code to combine the two for loops together, but this is my setup and it works, I put this on the footer of my Submission Form DataPage.
     

    <script>

    document.onchange = function() {
    var dropdown1 = document.getElementById('InsertRecordTitle');
    var dropdown1val = document.getElementById('InsertRecordTitle').value;

    var dropdown2 = document.getElementById("InsertRecordDescription");
    var dropdown2val = document.getElementById("InsertRecordDescription").value;

    for (var i=1; i<dropdown2.length; i++) {
        if (dropdown2.options[i].value == dropdown1val){
            dropdown2.options[i].style.display = "none";
        }
        else {dropdown2.options[i].style.display = "block";}
    }

    for (var i=1; i<dropdown1.length; i++) {
        if (dropdown1.options[i].value == dropdown2val ){
             dropdown1.options[i].style.display = "none";
           }
        else {dropdown1.options[i].style.display = "block";}
      

    }
    };

    </script>

    check out how this works in this link https://c2aby549.caspio.com/dp/83ff800033fd0e1cb5154f31a868

    Hi @TellMeWhy, I apologize for the late reply, and thank you for this script! It's working for me now, however, if you have time, how will this look like if say I have three dropdowns instead?

  3. I am passing Parameters through Query String, but it's getting cut off! I am passing multiple fields, maybe 8 of them, including a description. Is it because it's too long? What else can I use then? 

     

    I'm using an HTML Block on Details of Reports DataPage and when I click on the link, I want to pass the parameters to a Submission Form.

  4. I can't give you an exact code, but I can give you a suggestion, I guess?

    That's kind of complicated for two field validation. If you may, can you just use a Submission Form instead of Inline Insert? You can put the link on the header of your Reports DataPage and use a pop-up window. 

    JavaScript Validation would be much easier to implement on a Submission Form, or you can even use Rules or Calculated Fields to check the field.

    Let's say you have Field 1 - you can then create a Virtual Field > set it to Calculated Value > check the value of Field 1 (i.e. CASE WHEN Field1 < 0 THEN "Invalid" ELSE "OK" END

    Then on your Field 2 - created another Virtual Field > set to Calculated Value > check the value of Field 2, you can even insert Field 1 here (i.e. CASE WHEN FIELD1 < 100 AND AGENTID = 0 THEN "INVALID" ELSE "Good" END

    Then on your JS code, just listen to the whole document like - document.addEventListener("change", function(e) - then, inside, if one of the calculated values is not "OK" prevent the form to submit - preventDefault();

     

    Again, this is just a workaround I thought of, you can easily disregard if you really want to go the inline insert route

     

  5. 18 hours ago, smsnyus1 said:

    Hello Jnordstrand,  Did you ever get the quiz app setup, if so can you send me any tips on how you did it.  I'm trying to setup one as well and seems harder than I thought it would be.  Thanks for any help.

    Are you creating a short quiz/test ? Generally, for quiz form, you will have to create one field in your table for each question so you may store the answer individually.

    If you have 10 questions, that will translate to 10 fields in a table (i.e question1-10)

    Then on your form, you can use Text Fields or Radio Buttons depending on what type of test it is. I will not recommend multiple answers in one question (i.e. A, B) as that you may encounter issues. What you can do for that is use one option (i.e. D.) Both A and B))

     

    If you want to reveal their test results after they submit, you can do so using a Details Page DataPage.

    Using Calculated Values you can set that if it's not the correct answer, it will show 'incorrect' . For Calculated Values, you may check this HowTo Article: https://howto.caspio.com/datapages/datapage-components/calculated-values/

    and for the conditional formula you may refer to the Case Function under  MISCELLANEOUS FUNCTIONS AND EXPRESSIONS section of this How to Article:

    https://howto.caspio.com/function-reference/

  6. Hi, as the title suggests. I have two dropdowns on my DataPage with the same Lookup Table. If an option is already selected on the first dropdown, I want to remove that option on the second dropdown so the user can't select the same option on both dropdowns. Does anyone know if this is simple enough to do in Caspio? Thanks!

  7. Hi all,

    I'm trying this one out (https://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-convert-existing-html-forms-to-work-with-caspio/)as I already have an HTML form, and I want to try to convert it to Caspio DataPage but the parameters are not being passed. Below is a sample form I'm using to test it out

     image.png.b56081ff696f47da055f0ce66e790071.png

     

    Here is the HTML Form

    image.png.23191d1b5de412e94e3d23a408473a4d.png

    And here is where it's redirected, all blank

    image.png.ba5bd8eb680955a46d906a771e9f1cf4.png

×
×
  • Create New...