Jump to content

George43

Caspio Ninja
  • Content Count

    37
  • Joined

  • Last visited

  • Days Won

    4

George43 last won the day on April 25

George43 had the most liked content!

About George43

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Could you provide me with Deploy URL of the Data Page and Detail Description?
  2. 1)Make sure HTML editor is turned off. Advanced setting. It can cause creating unproper ASCI symbols. 2) Paste the Code <div id='mydiv[@field:MyRecordUniqueID]'></div> <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { if (("[@field:myfield1]" == "SHOW") && ("[@field:myfield2]" == "active")) { document.querySelector("#mydiv[@field:MyRecordUniqueID]").innerHTML =`<div>[@field:myfield3!]</div>`; } }); </script>
  3. You should add this code below. <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { document.querySelector('#InsertRecordSource_Shift').addEventListener('onChange',()=>{ //your function body }) }); </script>
  4. I have tested this code with validation. You can adjust validation rules and it will be prevent delete event. <script> var validation = true; //// Validation of the Delete Button if (document.querySelector('input[id^="Mod0DeleteRecord"]')){ document.querySelector('input[id^="Mod0DeleteRecord"]').addEventListener('mousedown', function(event) { if (1==1){ validation = false; //YOUR Logic for the Delete Validation } }); } ///// if (document.querySelector('input[id^="Mod0EditRecord"]')){ document.querySelector('input[id^="Mod0EditRecord"]').addEventListener('mousedown', function(event) { validation = true; //For Working Edit Buttons }); } if (document.querySelector('input[id^="Mod0CancelRecord"]')){ document.querySelector('input[id^="Mod0CancelRecord"]').addEventListener('mousedown', function(event) { validation = true; //For Working Back Buttons }); } document.addEventListener('BeforeFormSubmit', function(event) { if (!validation){ alert('EVENT Prevented'); //Some custom alert. event.preventDefault(); } }); </script>
  5. You should additional check for undefined. I would like to add in this case if parameter is not set it will be Undifined. Please try this code. <button type="button" class="clientbutton" onclick="myFunction([@field:CG_Client_ID])">Start WO</button> <script> function myFunction(x) { var strUser, endUser, midUser,bUser, fUser; if (document.getElementById(x)){ // Getting the value of the first drop-down var e = document.getElementById(x); strUser = e.options[e.selectedIndex].value; } if (document.getElementById('2' + x)){ // Getting the value of the second drop-down var f = document.getElementById('2'+x); endUser = f.options[f.selectedIndex].value; } if (document.getElementById('3' + x)){ // Getting the value of the third drop-down var g = document.getElementById('3'+x); midUser = g.options[g.selectedIndex].value; } if (document.getElementById('4' + x)){ // Getting the value of the third dropdown var h = document.getElementById('4' + x); bUser = h.options[h.selectedIndex].value; } if (document.getElementById('5'+x)){ //Getting the value of the fifth dropdown var j = document.getElementById('5'+x); fUser = j.options[j.selectedIndex].value; } window.location.replace("https://c3eku680.caspio.com/dp/e75050009fd4376eab4---------?val=" + strUser + "&val2="+endUser + "&val3="+midUser + "&val4="+bUser + "&val5="+fUser); } </script>
  6. @kpcollier Could provide me with exported copy of you Data Page?
  7. I Have team members who can take day-off. I want to colorize Day's based on Rule or Status
  8. You should add this code to the HTML block with Disabled HTML Editor just below search fields. Search field labels should contain Phone and Email parts of words. Example of the app provided below. This soulition is perfectly fit for validating search fields on Search Report Data Page <SCRIPT LANGUAGE="JavaScript"> let validationForm = false; document.addEventListener('DataPageReady', function(event) { const searchInput= 'input[id^=Value]'; document.querySelectorAll(searchInput).forEach(function (element, key, nodelist){ const candidatePhone = "hone"; const candidateEmail = 'mail'; const searchLabelPath = nodelist[key].closest('tr').childNodes[0].childNodes[0].innerHTML; if(searchLabelPath.indexOf(candidatePhone)!=-1){ nodelist[key].maxLength = 14; nodelist[key].placeholder='Type your Phone'; nodelist[key].onkeyup = function(keyUpEvent) { keyUpEvent = keyUpEvent || window.event; const isCharacters=keyUpEvent.keyCode >= 65 && keyUpEvent.keyCode <= 90; const isSpecial=keyUpEvent.keyCode >= 37 && keyUpEvent.keyCode <= 40; if (isCharacters){ this.value = this.value.substr(0, this.value.length - 1); return; } const formattedValue = (this.value.replace(/[^\d]/g, '')); switch(formattedValue.length){ case 7: this.value = (formattedValue.substring(0,3) + "-" + formattedValue.substring(3,7)); break; case 10: this.value = ("(" + formattedValue.substring(0,3) + ") " + formattedValue.substring(3,6) + "-" + formattedValue.substring(6,10)); break; } } } if (searchLabelPath.indexOf(candidateEmail)!=-1){ nodelist[key].maxLength = 25; nodelist[key].placeholder='Type your Email'; document.addEventListener('BeforeFormSubmit', function(event) { if(nodelist[key].value.indexOf('@')==-1){ event.preventDefault(); alert('Please check your Email adress.'); } }); } }) }); </SCRIPT> phone_1_0_2019-Apr-12_0935.zip
  9. Please try this code. If you have any problems please provide export of your app without sensative data in order to customize more deeply. <script> document.addEventListener('BeforeFormSubmit', function(ev) { var virtual3 = +document.querySelector(`[action*="[@cbAppKey]"] [id*=cbParamVirtual3]`).innerText; var virtual7 = +document.querySelector(`[action*="[@cbAppKey]"] [id*=cbParamVirtual7]`).innerText; var virtual8 = +document.querySelector(`[action*="[@cbAppKey]"] [id*=cbParamVirtual8]`).innerText; var virtual11 = +document.querySelector(`[action*="[@cbAppKey]"] [id*=cbParamVirtual11]`).innerText; var virtual14 = +document.querySelector(`[action*="[@cbAppKey]"] [id*=cbParamVirtual14]`).innerText; if (virtual8 > virtual3 || virtual8 > virtual7 || virtual8 > virtual11 || virtual8> virtual14) { ev.preventDefault(); alert("Error: Not enough spaces! Please chose a tour with more availability"); } }) </script>
  10. This code designed to work on tabular report in separate block for each record.
  11. Have you checked the names of your fields? Also have uncheckeed HTML Editor? 1) RECORD_ID 2) SHIP_ID
  12. you should un-comment redirection <button type="button" id="button[@field:RECORD_ID#]">Settle</button> <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { document.getElementById('button[@field:RECORD_ID#]').addEventListener('click',()=>{ if(+'[@field:SHIP_ID]'==53){ window.location.href = 'app.mysite.com/admin/settlement/otc/?SHIP_ID=[@field:SHIP_ID]&RECORD_ID=[@field:RECORD_ID]&PORT=[@field:PORT]&DATE=[@field:DATE*]'; }else{ window.location.href = 'app.mysite.com/admin/settlement/ship/?SHIP_ID=[@field:SHIP_ID]&RECORD_ID=[@field:RECORD_ID]&DATE=[@field:DATE*]'; } }); }); </script>
  13. If you are using getElemnentsBy Name you should specify number of array element: document.getElementsByName("Value1_1")[0].value
  14. Hi there I prepared an example. You can change and add conditions and URL. But logic should work if you will have difficulties just ask me. Href should be changed because they are equal now. <button type="button" id="button[@field:id#]">Click me</button> <script type="text/javascript"> //add field ID with autonmber to your report document.addEventListener('DataPageReady', function (event) { document.getElementById('button[@field:id#]').addEventListener('click',()=>{ //comparing x to y redirection if(+'[@field:SHIP_ID]'==53){ //window.location.href = 'page x url'; //add url links }else{ //window.location.href = 'page y url'; //add url links } //comparing Tour Site switch (+'[@field:TOUR_SITE_ID]') { case 1: case 2: case 3: //you can add case before case 8 case 4: case 6: case 8: window.location.href = "https://www.myapp.com/system/food-plan/?RECORD_ID=[@field:RECORD_ID]"; //url links customization break; case 5://you can add case before case 7 case 7: window.location.href="https://www.myapp.com/system/food-grid/?RECORD_ID=[@field:RECORD_ID]"; break; default: console.log('error'); break; ///etc you can edit cases and so on. } }); }); </script>
  15. You should Add Event Listener on that particular Input and apply style to all child Nodes <script type="text/javascript"> document.addEventListener('DataPageReady', function(event) { document.querySelectorAll("[name~='InlineAddemail']")[0].addEventListener('click', function(){ if(document.querySelectorAll('.Ctnr')[0]){ document.getElementsByClassName('DropBox')[0].style.setProperty('width', '350px'); document.querySelectorAll('.Option').forEach(function(elem){ elem.style.setProperty('border-bottom', '1px solid black'); elem.style.fontFamily = 'Lucida Console'; }); } }); }); </script> InlineAddemail is your Input name attribute. You can find it via chrome developer console.
×
×
  • Create New...