Jump to content

ezIQchad

Caspio Guru
  • Content Count

    238
  • Joined

  • Last visited

  • Days Won

    32

Posts posted by ezIQchad


  1. Unsure, but I wonder if the authenticated DataPage has not had a chance to load yet so the test will always fail as it runs too early.

    Try an iframe deployment and run the check onload.

    <iframe name="dp_name" title="dp_name" src="https://123.caspio.com/dp/123">Sorry, but your browser does not support frames.</iframe>
    
    <script>
      var loggedInTestIfr = document.getElementsByName('dp_name')[0];
      loggedInTestIfr.onload = function(){ checkLoggedIn(); };
      
      function checkLoggedIn(){
        var myTestElem = document.getElementById('loggedInTestDiv');
        if (myTestElem == null) {
            //user not logged in
            console.log('Not logged in');
        } else {
            //user logged in
            console.log('Logged in');
        }
      }
    </script>

    What is the URL for you page? I'll take a look (if you also answer, or at least try to answer, the questions above)


  2. If you have updated your DataPages to use the subdomain for your account in the deploy code, the logout link now uses the account subdomain for your  account.

    Rather than

    b5.caspio.com/folderlogout

    try

    ******.caspio.com/folderlogout

    where ****** is your 

     

    Also, see: https://howto.caspio.com/deployment/caspio-site-vs-account-subdomain-deployment/

     

    Hope this helps


  3. On 12/12/2017 at 4:47 AM, brunor said:

    Working with Chad (ezIQ) was effortless and an absolute pleasure. I asked him to figure out a few custom solutions for my Caspio project, and he quickly provided javascript solutions that have functioned beyond my expectations. His code is well organized and includes plenty of comments for the novice, such as myself. I highly recommend his services and look forward to future projects.

    Thanks Bruno, it was a pleasure working with you! I look forward to staying connected and seeing your project (great idea, I must say) grow and evolve!


  4. On 7/6/2017 at 2:11 AM, Vitalikssssss said:

    Please clarify how you would like to use these variables?   

    I want to see a list of available variables I can use here or there.

    What specifically brought me to this question were File Size error messages and a Date Format error messages that are vague and nondescript.

     

    I know I can change the wording, which helps, but I'd like to use the cool variables like "Are you sure you want to delete %n records" in the rest of my error messages.

     

    Does anybody know how to use these cool variables?

     


  5. Hello,

    I'm tying to improve my app's error messages using Localizations.

    I see on some error messages there are variables or parameters that provide the user with some very valuable information.

    • Value cannot be shorter than %s characters.
    • Value cannot be larger than %n characters.
    • Are you sure you want to delete %n records.
    • %p authorization failed.
    • Cannot redirect to %p
    • etc.

    Does anybody know how to use these, or where I can find a list of the variables we can use and how to?

     

     

    Thanks and ThinkEZ


  6. Thanks!

    Those are good options.

    I ended up using a workaround using ABSOLUTE.

    Substring([@field:ScratchPad],
    	Charindex(': ',[@field:ScratchPad],
    		Charindex('Passport Date of Issue: ',[@field:ScratchPad])
    	) + 2,
    	Abs(
    		Charindex('===',[@field:ScratchPad],
    			Charindex(': ',[@field:ScratchPad],
    				Charindex('Passport Date of Issue: ',[@field:ScratchPad])
    			)
    		) - 
    		Charindex(': ',[@field:ScratchPad],
    			Charindex('Passport Date of Issue: ',[@field:ScratchPad])
    		) - 2
    	)
    )

     


  7. Hi,

    I'm stumped.

    This code works

    Substring([@field:ScratchPad],Charindex(': ',[@field:ScratchPad],Charindex('Departure Airport: ',[@field:ScratchPad])) + 2,Charindex('
    ======',[@field:ScratchPad],Charindex(': ',[@field:ScratchPad],Charindex('Departure Airport: ',[@field:ScratchPad]))) - Charindex(': ',[@field:ScratchPad],Charindex('Departure Airport: ',[@field:ScratchPad])) + 2)

    This code breaks with only a minor adjustment: changing + to - at the very end

    Substring([@field:ScratchPad],Charindex(': ',[@field:ScratchPad],Charindex('Departure Airport: ',[@field:ScratchPad])) + 2,Charindex('
    ======',[@field:ScratchPad],Charindex(': ',[@field:ScratchPad],Charindex('Departure Airport: ',[@field:ScratchPad]))) - Charindex(': ',[@field:ScratchPad],Charindex('Departure Airport: ',[@field:ScratchPad])) - 2)

    This code is a substring in example two that works until I add it to the code above

    Charindex('
    ======',[@field:ScratchPad],Charindex(': ',[@field:ScratchPad],Charindex('Departure Airport: ',[@field:ScratchPad]))) - Charindex(': ',[@field:ScratchPad],Charindex('Departure Airport: ',[@field:ScratchPad])) - 2

     

    Any help will be appreciated


  8. Hi @abelphathost,

    Thanks for the message, but let's not ask questions privately.... the point of a forum is for people to find that somebody else has already asked the same question.

     

    Quote

     

    Hi, Hope you are fine,

     

    May you please help me out. I am having a serious problem with what I want to achieve here. I want to update a database field named status and change it's value to approved when a checkbox is checked or leave it as pending when the checkbox is not checked. here is my code:

     

    <SCRIPT LANGUAGE="JavaScript">
     
    function Updatestatus()
    {
    if (document.getElementById("approved").checked==true)
    {
    document.getElementById("status")="approved";
    }
    else if (document.getElementById("approved").checked==false)
    {
    document.getElementById("status")="pending";
    }
    document.getElementById("caspioform").onsubmit= Updatestatus;
     
    </SCRIPT>

     

    its not doing anything i don't know where I am wrong. please assist

     

    A couple things to note

    1 - I've had trouble using JS and Caspio's checkboxes. Dropdowns are easier to work with.

     

    2 - I never use 'onsubmit'. Rather i create a fake submit button that runs that code I need before the submit happens then wrap the function with: document.getElementById("Submit").click()

     

    ** If you must have something easier than a dropdown...

     This takes some work, but will allow you to do it.

     

    HTML block

    <style>

    #YOUR_FIELD_ID {display: none}

    .fake-radio {

      width: 120px;

     height: 50px;

     padding: 16px;

     margin: 16px 0 0 32px; 

    font-size: 18px;

     float: left;

    }

    </style>

     

    <div class="fake-radio" onclick="document.getElementsByName('YOUR_FIELD_ID')[0].value = 'Yes';>Yes</div>

     

    <div class="fake-radio" onclick="document.getElementsByName('InsertRecordFieldName')[0].value = 'No';>No</div>

     

     

    YOUR_FIELD_ID

    1. right click the field you want to populate > inspect

    2. Look for <xx class="sample" id="XYZ_98sd7d" name="InsertRecordYOURFIELDNAME">Hi World</xx>

    3. your answer is InsertRecordYOURFIELDNAME

     

    Try these suggestions and I'm sure you'll find your solution


  9. Hi @TWIRED,

    Thanks for your message. Let's do it out here so everybody can see the Q&A.

    Quote

    Hey Chad, could surely use your help

     

    We are unable to display a stored image file in Caspio bridge.

     

    Have tried all sorts of urls but keep getting "File Or Directory Unknown"

     

    How does one get the fileid of an image store din caspio

     

    WHat is the correct friendly way to display an image or file stored in the bridge.

     

    Here is a link which used to work, but no longer works :(

    This image exists at the path and the app key is the datapage key which displays the results

    https://c2eku***.caspio.com/dpImages.aspx?AppKey=*************&file=/IMAGES_/TRIPATWORK/TESTIMAGES/spiderman.jpg

     

    Thanks !

    Your path looks good.

    Two things to check.

     

    If it was working, then stopped... check to make sure the DataPage you're sharing these images from DOES NOT require authentication. (something it may not have required when it worked)

     

    I also notice your Account Subdomain [Caspio account settings > c2eku***.caspio.com] in use as the domain.

    I use my Caspio Site [Caspio account settings > b5.caspio.com] as the bdomain for this link.

    Hope this helps


  10. Try making the first page a user begins this process on a submission form that will alert the user when they're adding the duplicate record BEFORE any auto-submitting.

    I can't tell for sure, but it seems like you're passing params from one DP to the next in order to add multiple records. Then along the way, a non-unique error pops up and a loop ensues. Ensure this error prevents the user from proceeding by moving the unique record to the beginning.

     

    You can also add code to the Localization Error message.

     


  11. HTML Block

    *You must use a div - not an a tag. Caspio's HTML editor doesn't allow you to have divs inside an a tag.

    <div onclick="location.assign('yourLink.html');">

          <div class="field-1">[@field:DataSourceField1]</div>

          <div class="field-2">[@field:DataSourceField2]</div>

          <div class="field-3">[@field:DataSourceField3]</div>

    </div>


  12. You're using the same identifier for different calcs.

    var convertField = document.getElementsByClassName('cbFormData')[0];

    This is why the value from the second calc is showing up in the first element.... the first code runs perfectly, then before you can see the result the of that calc, the second code fills the data into the first element.

    Might be as simple as changing to  var convertField = document.getElementsByClassName('cbFormData')[1];

     

    Try to use ID rather than CLASS[*], you have much better control. If your Virtual Params are Cascading, that explains why you can't use ID.


  13. I can't tell when you want the data copied based on your question, so I'll try to help, assuming you want the description copied after the user types a description.

    <script>
    var caspioDescriptionElement = document.getElementById('EditRecordDescription');
    var formDescriptionElement = document.getElementById("cbParamVirtual1");
      
    formDescriptionElement.onchange = function() {
       caspioDescriptionElement.value = formDescriptionElement.value;
    }
    </script>

    While writing this, I noticed that you're missing a "document" before  "getElementsByName("cbParamVirtual1")[0].value; ". That might fix your code.


  14. You're using a JS var outside of a JS function. - <a href=("dynLink")....

    Rather, you need assign the href from within the JS function.

    You can also simplify your code by removing the else and simply starting with the link that should be there when the "if" fails

    <script>
    
    window.onload = testFormRes;
    
    function testFormRes()
    {
      var dynLink;
      var linkEle = document.getElementById('dynLinkEle');
    
    if ("[@authfield:Restricted^]"=="yes"){
      dynLink="https://c0ect240.caspio.com/dp.asp?AppKey=eeda30004146e1be17fe4f64a319";
      linkEle.href = dynLink;
      }
    }
    </script>
    
    <a id="dynLinkEle" href="https://c0ect240.caspio.com/dp.asp?AppKey=eeda3000a155f226d27146b0ae20"  class="btnPatrolForm">ActivityForm</a>

     


  15. Check out this amazing trick I learned this morning.

    You can pass params into a datapage by adding the param right into the snippet from Caspio

    <script type="application/javascript">
        var someVar = 'abc';
        try{f_cbload("****************89c82&tf="+someVar,"https:");}catch(v_e){;}
    </script>
    
    
    My actual use case
    <script type="application/javascript">
        var htmlFile = location.pathname.substring(location.pathname.lastIndexOf("/") + 1);
        try{f_cbload("****************89c82&tf="+htmlFile,"https:");}catch(v_e){;}
    </script>

     

×
×
  • Create New...