Jump to content

MayMusic

Caspio Evangelist
  • Posts

    1,510
  • Joined

  • Last visited

  • Days Won

    78

Reputation Activity

  1. Like
    MayMusic reacted to kRv in Reload Main Page   
    Hello Farnsbarnes,
    Can you tell me please, do you use different domains for parent page, and for iframe? If yes, proposed solution cannot works due to security restrictions. Can you please open browser console, and look for some run-time errors, when you submit form in iframe? Can you see some error with similar text? "SecurityError: Blocked a frame with origin..." 
    If you have similar error, you can use some different technique based on messages. Please pay your attention that it will works in modern browsers only. You can see list of supported browsers here http://caniuse.com/#search=postMessage  
     
    Add code below to header on your parent page:
    window.onmessage = function (e) { if (e.data === "refresh") { location.reload(); } }; Add code below to footer in your DataPage, which will open via iframe.
    <script type="text/javascript"> document.getElementById("caspioform").onsubmit = function () { if (window.parent && window.parent.postMessage) { window.parent.postMessage("refresh", "http://bridge.caspio.net"); //put your own domain here } } </script> Thanks
  2. Like
    MayMusic got a reaction from NaghmehK in Checkbox on Submit if statement   
    You can have the code below:

     
    <script> document.getElementById("Submit").onmouseover = function(){ if (document.getElementById('Dropdown ID').value == "National"){ document.getElementById('InsertRecordYesNo').checked = true; }else{ document.getElementById('InsertRecordYesNo').checked = false; } } </script>  
     
    InsertRecordYesNo  is the ID of checkbox and Dropdown ID is the ID of dropdown. This function will fire when you hoverover Submit button,
  3. Like
    MayMusic got a reaction from ArdmxurEn in Add days   
    If you want t0 add to a date which is being selected on the page then use
    <script> function f_date(){ var v_currentDate=new Date(document.getElementById('InsertRecordDATEFIELDNAME').value); v_currentDate.setDate(v_currentDate.getDate() +10); var v_assignDate = (v_currentDate.getMonth() + 1) + "/" + v_currentDate.getDate() + "/" + (v_currentDate.getFullYear()); alert(v_assignDate); document.getElementById('InsertRecordNAME OF THE FIELD WHERE YOU WANT TO SAVE THIS DATE IN').value = v_assignDate; } document.getElementById('InsertRecordDATEFIELDNAME').onchange=f_date; </script>
  4. Like
    MayMusic got a reaction from aam82 in Expiration Field Update   
    <script> function f_date(){ var expireDate=document.getElementById('EditRecordDATEFIELDNAME').value; var v_assignDate = (expireDate.getMonth() + 1) + "/" + expireDate.getDate() + "/" + (expireDate.getFullYear()+1); document.getElementById('EditRecordDATEFIELDNAME').value = v_assignDate; } f_date(); </script> try the code above in the Footer of your update page. "EditRecordDATEFIELDNAME" needs to be replaced with ID of date field.
  5. Like
    MayMusic got a reaction from MarkD in Maps And Search Results - How To Display Different Numbers Or Results   
    You need to have another report page which is pulling all the results and create your map of off that. Hide the report and only show the map. Then deploy both report pages on one web page.
  6. Like
    MayMusic got a reaction from JEllington in Passing Parameters From A Report   
    When you have a many to many relationship you need to create a join table to break it to two one to many relation.
  7. Like
    MayMusic got a reaction from JEllington in Thank You Maymusic   
    Thank you so much for your kind words!
  8. Like
    MayMusic reacted to Olfa in Datapage Destination Parent Frame On Submit   
    setInterval is going to execute your ReloadParent function evry 3 second. in order to reload the parent page only once you have to use setTimeout function.

    Or you can simply use the code bellow
    <script> myFunction() { window.parent.location.reload(); } document.getElementById("caspioform").onsubmit=myFunction; </script> Olfa
  9. Like
    MayMusic got a reaction from Master in Create Link On Fly Based On Dropdown Selection   
    Let's say you have the name and URL in table. Include both to your page
     
    Name: dropdown
    URL: Cascading dropdown
     
    Add a HTML Block right after Name field and have the code below to show the link after selection
    <div id="details"></div> Add one HTML Block above URL field and paste the code below to hide cascading
    <table style="display:none;"><td> One HTML Block below URL and use the code below:
    </td></table> <script> document.getElementsByName('InsertRecordName')[0].onblur= function (){ var URL = document.getElementsByName('InsertRecordURL')[0].value; if (URL){ document.getElementById('details').innerHTML="<a href="+URL+">Details </a>"; } } </script> Replace "InsertRecordURL" and "InsertRecordName" with the actual field names.
  10. Like
    MayMusic got a reaction from jhanajc in Data Usage Thoughts, Tools, Tactics   
    When you open a page from browser, import, export data to Caspio it goes toward your data transfer usage. You can use developer tools like firebug to see how much a page usages for each load. It is under Net tab and look for Size.
     
    You can try to contact your assigned success manager and see if they can wave the developing period over-usage fee for you.
  11. Like
    MayMusic got a reaction from JEllington in Show/hide Results Page   
    Have a div around each report deploy code and give it an ID and hide it, for instance:
     
    Report 1:
    <div id="r1" style="display:none;"> Caspio Deploy code of report 1 </div> Report 2:
    <div id="r2" style="display:none;"> Caspio deploy code for report 2 </div>  And then on the web page have this script below all deploy codes:
    <script> var report = getParameterByName('r'); if (report == 'r1'){ document.getElementById('r1').style.display = 'inline-block'; } else if (report == 'r2'){ document.getElementById('r2').style.display = 'inline-block'; } function getParameterByName(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); } </script> Note, the destination after submission on search page you have URL to the page where you have deployed your pages in this format:
     
    http://URL?r=[@field:NAME OF THE FIELD USER SELECTS REPORT]
  12. Like
    MayMusic got a reaction from JEllington in Using Rules & Criteria To Selectively Display Certain Fields   
    Also remember that you can add Sections as well, sometimes you use one field and you cannot use it again. In that case, you can add Section for that field use section once and then field itself
  13. Like
    MayMusic got a reaction from JEllington in Caspio Wordpress Comments   
    What I know about wordpress is styling issue I have never heard about passing parameter issue I know wix has issues with passing param and wordpress is breaking styles.
  14. Like
    MayMusic got a reaction from acslakeland in Passing Authentication Through Iframes   
    I have tried to deploy 2 pages as iframe and I still stay in both!!! It should be working as long as you stay in the same browser. I even tried on my phone and it is working fine.
    If you give me the URL to your page I might be able to figure out the issue
  15. Like
    MayMusic reacted to Aurora in Condition Dropdown Values   
    Hi Michelle !
     
    I think I have some similar code. In my case there are 3 values - Done is # 1 in dropdown , which equals [0] in the script, Pending-#2 in dropdown and equals [1] in script, and Canceled-  #3 in dropdown, [2] in script. 
     
    Here is the code: 
    <SCRIPT LANGUAGE="JavaScript"> function calculate() { var dropdown =(document.getElementsByName("EditRecordYour_Field1")[0]); var date1 = new Date(document.getElementById("EditRecordDate_Field").value); var date2 =new Date(document.getElementById("EditRecordDate_Field2").value); if (date1>date2) { dropdown.options[2].selected=true; } if (date1<date2) { dropdown.options[0].selected=true; } if (date1.getTime()===date2.getTime()) { dropdown.options[1].selected=true; } } document.getElementById("EditRecordDate_Field2").onchange=calculate; </SCRIPT> The script works when you change second Date field. 
     
     
    Good luck, 
     
    Aurora
  16. Like
    MayMusic got a reaction from derekcaldwell in Conditional Roll-Over Message On Top Of A Conditional Image   
    You need to change the code to:
    <script> if ("[@calcfield:3]"!="[@field:Current_Pay_Grade]") { document.write('<img width="15px" src="https://umghr-sjecs....images/flag.jpg" />'); document.write("[@field:Current_Pay_Grade]  does not align with [@calcfield:3]. Check each job factor and the grand total."); } </script>
  17. Like
    MayMusic reacted to Xiang in Possible To Color Code Rows By Group In A Tabular Report?   
    Hi MikeP,
     
    How are you?
     
    I've written the code (you can add an HTML Block, place it the last element, click the Source button and enter the code):
    Do not forget to change "id" in two places ([@field:id]) - enter the name of your field with unique value (usually it is a field with the Autonumber DataType) and enter your values in blocks "first possible value", "second possible value". You can use as many blocks as you want.
    <div id="[@field:id]"></div> <SCRIPT LANGUAGE="JavaScript"> var line_id='[@field:id]'; var number_records_per_page = 25; //Records per page var line=document.getElementById(line_id).parentNode.parentNode; var elems = line.getElementsByTagName("td"); var myColor = ""; var mybgColor = ""; var colorAll = false; var comparisonText = ""; if(elems[0].innerHTML==" ") {    var isGroup = elems[0].parentNode.previousSibling.getElementsByTagName("td")[0];    if(isGroup.innerHTML==" ")    {       for(i = 1; i < number_records_per_page; i++)       {          isGroup = isGroup.parentNode.previousSibling.getElementsByTagName("td")[0];          if(isGroup.innerHTML!=" ") break;        }     }    comparisonText = isGroup.innerHTML; } else {   comparisonText = elems[0].innerHTML; } //first possible value if (comparisonText =="test"  || comparisonText =="test (Cont.)")  //enter your value instead of test {    myColor="blue"; //enter your text color instead of blue    mybgColor="yellow"; //enter your background color instead of yellow    var colorAll = true; } //second possible value if (comparisonText =="test" || comparisonText =="test (Cont.)") //enter your value instead of test {     myColor="red"; //enter your color instead of red     mybgColor="green"; //enter your background color instead of green     var colorAll = true; } if(colorAll) {    for (var i=0, m=elems.length; i<m; i++)    {       elems[i].style.color=myColor;       elems[i].style.backgroundColor=mybgColor;     } } </SCRIPT> I'll be grateful, if you tell me if the code works.

    Have a nice day!
  18. Like
    MayMusic reacted to Xiang in Can I Use A Aggregate (Total) In Js In The Footer ?   
    Hi peterhanse,
     
    Welcome to the Forum!
    How are you?
     
    I think, you can use the following code:
    <script> var column_number = 1; var myTable = document.getElementsByName("cbTable")[0]; var myRows = myTable.getElementsByTagName("tr"); var lastRow = myRows.length - 1; var myCells = myRows[lastRow].getElementsByTagName("td"); var myTotal = parseFloat(myCells[column_number].innerHTML); var paard = "voeg uw paard toe!"; var voegtoe = "upgrade uw acount!"; if(myTotal>0) { document.write("<p>Link: " + paard.link("http://google.nl") + "</p>") } else { document.write("<p>Link: " + voegtoe.link("http://caspio") + "</p>") } </script> Where column_number is the number of the Aggregation.
    If you use only one Aggregation, it'll be "1".
     
    I'll be grateful, if you tell me if the code works.

    Have a nice day!
  19. Like
    MayMusic reacted to Xiang in Validate Past And Future Dates   
    Hi everyone,
     
    I'd like to share this code, that validates if the entered date is correct.
    Enter the name of your field instead of "myDate", enter the correct numbers for allowedDaysInPast  and allowedDaysInFuture variables, enter texts of your messages.
    If you don't want to validate in past or in future you can delete the correspond block.
    Then add a Header@Footer element, select the Footer element, click the Source button and enter the code.
    <SCRIPT LANGUAGE="JavaScript"> function validate_dates() { var dateFieldName = "myDate"; var allowedDaysInPast = 1; var deniedMessagePast = "The entered date cannot be earlier than yesterday"; var allowedDaysInFuture = 1; var deniedMessageFuture = "The entered date cannot be later than tomorrow"; dateFieldName = "InsertRecord" + dateFieldName; var entered_value = document.getElementById(dateFieldName).value; var entered_date = new Date(entered_value); //Start of Validating in past var todayP = new Date(); var allowedDatePast = new Date(todayP.setDate(todayP.getDate() - allowedDaysInPast)); allowedDatePast = allowedDatePast.setHours(0,0,0,0); if(entered_date < allowedDatePast)    {       alert(deniedMessagePast);       return false;    } //Finish of validating in past //Start of Validating in future var todayF = new Date(); var allowedDateFuture = new Date(todayF.setDate(todayF.getDate() + allowedDaysInFuture)); allowedDateFuture = allowedDateFuture.setHours(23,59,59); if(entered_date > allowedDateFuture)    {       alert(deniedMessageFuture);       return false;    } //Finish of validating in future } document.getElementById("caspioform").onsubmit=validate_dates; </SCRIPT> I'll be grateful, if you tell me if the code works or if any errors occur.

    Have a nice day!
  20. Like
    MayMusic got a reaction from Aurora in How To Create Image Slideshow In Html   
    You can try to add this to the header
    <script type="text/javascript"> var image1 = new Image() image1.src = "images/image1.jpg" var image2 = new Image() image2.src = "images/image2.jpg" </script> And the code below where you want to show the slide
    <p><img src="images/pentagg.jpg" width="500" height="300" name="slide" /></p> <script type="text/javascript"> function slideit() { var step=1; document.images.slide.src = eval("image"+step+".src") if(step<2) step++ else step=1 setTimeout("slideit()",2500); } slideit(); </script>
  21. Like
    MayMusic got a reaction from derekcaldwell in Pass Paramter From Submission Page   
    If you want to pass the paramter on a button click:
    <script> function newFunction() { var v_param = document.getElementById("InsertRecordFIELDNAME").value; window.open('http://www.site.com/page.html?parameter1='+v_param); } </script> <input type="button" value="click me" onclick="newFunction()" /> If you wanto pass it after form submit, you can pass it through Caspio http://howto.caspio.com/parameters/passing-parameters/
  22. Like
    MayMusic reacted to MayMusic in Expiration Date   
    Add this code to the footer of the page. Make sure to replace "DATEFIELDNAME" with the field name you want to save this expiration date on
    <script> function f_date(){ var v_currentDate=new Date(); v_currentDate.setDate(v_currentDate.getDate() +10); var v_assignDate = (v_currentDate.getMonth() + 1) + "/" + v_currentDate.getDate() + "/" + (v_currentDate.getFullYear()); document.getElementById('InsertRecordDATEFIELDNAME').value = v_assignDate; } f_date(); </script>
  23. Like
    MayMusic got a reaction from NaghmehK in Expiration Date   
    Add this code to the footer of the page. Make sure to replace "DATEFIELDNAME" with the field name you want to save this expiration date on
    <script> function f_date(){ var v_currentDate=new Date(); v_currentDate.setDate(v_currentDate.getDate() +10); var v_assignDate = (v_currentDate.getMonth() + 1) + "/" + v_currentDate.getDate() + "/" + (v_currentDate.getFullYear()); document.getElementById('InsertRecordDATEFIELDNAME').value = v_assignDate; } f_date(); </script>
  24. Like
    MayMusic reacted to zzhwvw01 in refresh results page automatically   
    In case anyone else is interested, it was as simple as adding the following HTML Block in the Configure Results Page Fields.
     
    <META HTTP-EQUIV="refresh" CONTENT="120"> "120" being 120 seconds
  25. Like
    MayMusic reacted to MayMusic in Expired Records   
    Instead of the date field add an HTML Block to the Configure Results Page Fields screen and use this code:
    <script> if  (Date.parse('[@field:DateFieldName*]') > Date.parse('[@cbTimeStamp*]')) { document.write("<div style='color:red;'>[@field:DateFieldName]</div>"); } else { document.write("[@field:DateFieldName]"); } </script> Make sure you have enabled parameters and select [@field:DateFieldName] from the picker
×
×
  • Create New...