Jump to content

geoffdude

Caspio Ninja
  • Content Count

    46
  • Joined

  • Last visited

  • Days Won

    1

geoffdude last won the day on November 21

geoffdude had the most liked content!

About geoffdude

  • Rank
    Advanced Member

Recent Profile Visitors

478 profile views
  1. I'm on 20.3 .. strange huh? Update: I had to clear my cache to see the new version changes. It's all good now.
  2. Is "Loops" even available for tasks anymore? I don't see it.
  3. Can you share the URL to the page? .. I can look at the source code that way, and maybe help.
  4. Or .. given that it's a results page, maybe this is more accurate: <script> var isi = document.getElementById("visi[@field:UniqueFieldName]"); if ('[@choiceList FieldName]' == "1") { isi.parentNode.parentNode.style.backgroundColor = '#firstColor'; } else if ('[@choiceList FieldName]' == "2"){ isi.parentNode.parentNode.style.backgroundColor = '#secondColor'; } else if ('[@choiceList FieldName]' == "3"){ isi.parentNode.parentNode.style.backgroundColor = '#thirdColor'; } else if ('[@choiceList FieldName]' == "4"){ isi.parentNode.parentNode.style.backgroundColor = '#fourthColor'; } else{ isi.parentNode.parentNode.style.backgroundColor = '#defaultColor'; } </script> With "choiceList" being the results page targeted field name. Just change it to your unique field name.
  5. Well.. based on the code example you and caspio provided, I'd start from there, like so (again based on a drop down): <script> var isi = document.getElementById("visi[@field:UniqueFieldName]"); var select = document.getElementById("fielda"); var selectedString = select.options[select.selectedIndex].value; if (selectedString == "1") { isi.parentNode.parentNode.style.backgroundColor = '#firstColor'; } else if (selectedString == "2"){ isi.parentNode.parentNode.style.backgroundColor = '#secondColor'; } else if (selectedString == "3"){ isi.parentNode.parentNode.style.backgroundColor = '#thirdColor'; } else if (selectedString == "4"){ isi.parentNode.parentNode.style.backgroundColor = '#fourthColor'; } else{ isi.parentNode.parentNode.style.backgroundColor = '#defaultColor'; } </script> This script should go at the bottom of the page in an HTML block .. and the colors would be hexadecimal like (#0000FF) or just "cyan", "yellow" etc.. but no number sign when using just color names.
  6. Take this sample code below and play around with it a bit. - Note the script works based upon a select dropdown .. then targets a DIV by changing it's background color and placing the selected value into the targeted span id. - This may help you alter your code to achieve similar results. <!doctype html> <html> <head> <meta charset="UTF-8"> <title>Untitled Document</title> </head> <body> <select id="fielda"> <option value="0">Select</option> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> <option value="4">four</option> </select> <div id="answerBox" style="background:#ccc; width:50%; margin:20px auto; border:1px solid red; padding:5px; color:#000; font-size:14px">Answer = <span id="selectNmbr" style="color:red; font-weight:bold">Selected Option</span> </div> </body> <script> var select = document.getElementById("fielda"); select.onchange = function(){ var selectedString = select.options[select.selectedIndex].value; if (selectedString == "1") { document.getElementById("answerBox").style.background = 'pink'; document.getElementById("selectNmbr").innerHTML = selectedString; } else if (selectedString == "2") { document.getElementById("answerBox").style.background = 'lime'; document.getElementById("selectNmbr").innerHTML = selectedString; } else if (selectedString == "3") { document.getElementById("answerBox").style.background = 'cyan'; document.getElementById("selectNmbr").innerHTML = selectedString; } else if (selectedString == "4") { document.getElementById("answerBox").style.background = 'gold'; document.getElementById("selectNmbr").innerHTML = selectedString; } else { document.getElementById("answerBox").style.background = '#ccc'; document.getElementById("selectNmbr").innerHTML = "Selected Option"; alert("nothing selected"); } } </script> </html> Good luck, LMK how it goes.
  7. Try targeting just the "label" tag .. then zone into which specific label tag to affect by changing the bracketed number [0], [1] etc. next to it. See my code below. <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { function myFunction() { var labelTarget = document.getElementsByTagName("form")[0]; labelTarget.getElementsByTagName("label")[0].innerHTML = ""; } }); </script> <!-- • The first part of the code finds the 1st[0] "form" tag • 2nd part of the code targets ALL the "label" tags as an array, but the unique label you want is found here > [0] .. this number needs to change until you find your specific label . once found, the script makes the label's HTML text become BLANK with the code call innerHTML = "" -->
  8. Great. And, you're very welcome. Best, Geoff
  9. Show, post, the code you used for the 2nd counter.
  10. • Use the same code, but change where it says "myFunction" to another name .. like "myFunctionB" or similar. Make sure to change all occurrences of it. • Also change the ID of the <span> tag to "cntB" and then change that in the script code too, so your counter text goes to the right area. • Finally - also change the target text area name, as you did earlier, to match what new text area field your targeting... Make sure and change all occurrences of it. LMK if this works.
  11. Try this. In your form add an HTML Block immediately under the textarea field. In the HTML block add this code below. Change the name of "InsertRecordmessage" to the unique name of your textarea field. Get that name by viewing page source while previewing the form. Here's the code: <!-- area counter text appears --> <div id="writing" style="width:90%; text-align:center; margin:0 auto 15px auto; font-size:11px; font-family:sans-serif; color:#000; padding:0 5%"> Total Word Count: <span id="cnt" style="color:red;">0</span> </div> <!-- script to capture keypress within the textarea field - change name of "InsertRecordmessage" if need be --> <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { document.getElementsByName("InsertRecordmessage")[0].addEventListener("keypress", myFunction); function myFunction() { var string = document.getElementsByName("InsertRecordmessage")[0].value; var wordcount = string.split(/[^\s]+/).length - 1; document.getElementById("cnt").innerHTML = wordcount; } }); </script> Good luck, LMK how it goes. Geoff
  12. OK - I circled back to this last night, and I figured it out. Basically I had to adjust script to adhere to CASPIO structure (which is always in flux) but I got it to work. Here's the solution: <script type="text/javascript"> document.addEventListener('BeforeFormSubmit', function(event) { event.preventDefault(); var emailid = document.getElementsByName("InsertRecordemail_id")[0].value; var emailconfirm = document.getElementsByName("InsertRecordemail_confirm")[0].value; var email_log = document.getElementsByName("cbParamVirtual1")[0].value; // checks entered email against email address list table of approved emails, stop submit if there's NO match if (emailid !== emailconfirm) { alert('Sorry, your email is not valid for this offer.'); } // checks if email_id field is empty, stops submit if no email is provided else if (emailid == "") { alert('You have not entered an email address.'); } // checks entered email against email log of previously submitted emails, stops submit if there IS a match else if (emailid == email_log) { alert('You have already requested this offer.'); } // submits form and valid email if emailid value and email_confirm value match else { document.forms["caspioform"].submit(); } }); </script> Also, I had to place some CSS styling in the form to hide the Virtual1 (email_log) field. Like so: <style> [name="cbParamVirtual1"] {display:none} </style> So there it is. - Request and solution complete. Have a good day all, Geoff
  13. It actually would be unique, and the basis to prevent the submission again, though only AFTER the initial submission. - Thx
  14. Hi all, Since all the changes here to forms and scripts use in them lately, I can't figure out a solution for form functions via javascript. Here's what I need, for form: - Email ID = (text field entry) - Email Confirm = (cascade text field with email addresses pulled in to check against from uploaded email addresses) - Email Virtual 1 (pulls in Log emails) = cascade text field that pulls emails from log table .. the LOG TABLE get's written to from EMAIL ID entry via an action I want a visitor to enter their email, or EMAIL ID, and then see that email address appear as confirmed in the "Email Confirm" field. They then can submit the form to get a gift, but once they do their email address goes to a "Email Log" table ... then that log table data is pulled into the "Email Virtual 1" cascade text field .. and if they try to submit the form again the script sees that email address there and prevents the form submission. I can't get this to work at all. Any help would be appreciated, thx, Geoff My code: <script type="text/javascript"> var emailid = document.getElementsByName("InsertRecordemail_id")[0].value; var confirm = document.getElementsByName("InsertRecordemail_confirm")[0].value; var vir1 = document.getElementById("cbParamVirtual1").value; document.addEventListener('BeforeFormSubmit', function(event) { if (emailid == confirm ) { return true; // submit form } else if (email == vir1 ){ alert('You have already submitted the form.'); event.preventDefault() // don't submit form because log data has email id in it } else alert('Your email id is invalid.'); event.preventDefault() // don't submit form because confirm email is not valid / not in data email table }); </script>
  15. That's the reverse of what I'm trying to do actually .. I have a file in my GD repository that's a native GD spreadsheet, that I want to import it's data INTO a caspio table .. but CASPIO scheduled import can't specifically target that file/doc as it's a Google file type of "sheet". - My wish, desire, was/is that CASPIO could sort this out and provide for that functionality (like Zapier does) for direct connection to any GD file.
×
×
  • Create New...