Jump to content

Harbinger

Caspio Guru
  • Content Count

    102
  • Joined

  • Last visited

  • Days Won

    4

Reputation Activity

  1. Thanks
    Harbinger got a reaction from Perzival in How to limit a form to not submit numeric   
    Try this:
    <script type="text/javascript">
    document.addEventListener('BeforeFormSubmit', function(event) {
    event.preventDefault();
    var x = document.getElementById('InsertRecordDOM').value;
         if (typeof x === 'number' || (x%1===0)) {
    alert('This form only submit alpha characters!');
    } else {
    document.forms["caspioform"].submit();
    }
    });
    </script>
  2. Like
    Harbinger reacted to DefinitelyNot31337 in Login after User Registration   
    Hello @TroubleShooter,
     
    Yes, you can. Currently, it is only possible with JavaScript.
     
    The idea is to place the Registration Form and Standalone Login Page side-by-side (or at least, in the same page).
    You may hide the Login Form ( using <div style="display: none;"></div> on the Header/Footer of the DataPage || More about here...), on your Registration Page but I rather keep them visible so the users can opt to just log-in if they already have an account; or register, if they don't.
     
    After registration, JavaScript will fill-out the login form, and submits it programatically, therefore logging-in the newly registered user.
     
    The only requirements to this implementation are:
    1.) Login DataPage and Registration Form DataPage are deployed on the same page.
    2.) Both DataPages are AJAX-Enabled!
    3.) Headers/Footers should have the HTML Editor disabled from the Advanced tab.
     
    Without futher ado, let's do this.
    1.) Open DataPage Configuration for your Registration Page:
    2.) Go to 'Configure Fields Section'
    2.1.) Add a Header and Footer (Disable HTML Editor from the advanced tab)
    2.2.) Paste the code snippet in the Footer and modify the following information.
    <script> document.addEventListener('BeforeFormSubmit', function() { var registrationDP = "[@cbAppKey]"; var loginDP = "378fd3458dfsjhefjhqerwfdsyui3274239"; //Replace with the AppKey of your Standalone Login Scren var username_field = "username"; //replace with the name of your username field (CASE SENSITIVE!) var password_field = "password"; //replace with the name of your password field (CASE SENSITIVE!) //No modifications necessary from this point onward. document.querySelector(`[action*="${loginDP}"] [id*=xip_username]`).value = document.querySelector(`[action*="${registrationDP}"] [id*=InsertRecord${username_field}]`).value document.querySelector(`[action*="${loginDP}"] [id*=xip_password]`).value = document.querySelector(`[action*="${registrationDP}"] [id*=InsertRecord${password_field}]`).value }) </script>  
    5.) Go to 'Destination and Messaging'
    5.5) Set Destination after record submit to: Display a message; Disable the HMTL Editor!
    5.6) Paste the code snippet below; then modify.
    Registered Successfully. <script> var loginDP = "378fd3458dfsjhefjhqerwfdsyui3274239"; document.querySelector(`[action*="${loginDP}"]`).submit(); </script>  
     
    After saving, you should be good to go.
    Working example: https://stage.caspio.com/support/forums/DefinitelyNot31337/register-login/index.html
    Application Export Package: CaspioData_2019-Apr-02_0219.zip
     
    Good luck and happy hacking!
     
    Regards
    DN31337!
  3. Thanks
    Harbinger got a reaction from Jess147 in Totals   
    Hi @Jess147, First off, I would suggest using a triggered action in your main table to calculate the total of the column, then send the value to another field from the table where you will insert the data. To do this, you will need to add an INSERT block, select the table where you want to insert the data --> Now set the field that will contain the total calculation and send to another field that will receive the value to the selected table.
    Here's the screen capture of my sample triggered action.

     
    I hope this helps.
     
    ~ H
  4. Like
    Harbinger reacted to LunaLovegood in Authorization failed. Each Google Drive account can only be used once as a Site.   
    When you're receiving an error: "Authorization failed. Each Google Drive account can only be used once as a Site." setting up DataHub/Scheduled import, you need to check your Google Account Settings. Go to Sign-in & Security and then Apps with Account access. Check if Caspio DataHub is already on the list.
    Then click Manage Apps, and remove access to Caspio DataHub.
    Go inside your Caspio Bridge and re-established the connection.
  5. Like
    Harbinger reacted to JolliBeng in Exporting Data   
    Hi @Role21,
    You can enable the Download options on your Report DataPage. Select Download as Excel. So, you can be able to download the data on your Calculated Fields.

     
    -JolliBeng
  6. Like
    Harbinger got a reaction from kpcollier in Styling tables   
    Just to add, in case you want a fully customizable style, you can go to the Styles as what KPCollier instructed, then go to the source and look for the tr tag.
    From there you can add CSS codes to customize your table's attributes.
  7. Thanks
    Harbinger got a reaction from Perzival in Styling tables   
    Hello, you can add a header and footer to that particular DataPage then disable the "enable HTML editor" from the advance tab, and in the standard tab, kindly right the following script.
    <style>
    #caspioform > table tbody tr:hover {
        background-color: #f5f5f5;
    }
    </style>
  8. Like
    Harbinger reacted to NikkiC in Inline edit only in certain circumstances   
    Hi there,
    I have a tabular report with inline edit and delete enabled.  This report shows a list of comments made by different users.  I wish to only show the edit / delete options for the user who has made the comment.   I have tried this:
    <script> var user = "[@authfield:User_info_User_ID]"; var author = "[@field:Card_comments_and_updates_Author_ID]"; if (user === author) { document.getElementByClassName("cbResultSetActionCell").style.display = "block"; } if (user !== author) { document.getElementByClassName("cbResultSetActionCell").style.display = "none"; } </script> but it's not working.  I think it's something to do with the fact I've used "getElementByClassName", but there is no ID assigned to this field, so not sure how to reference it.  I've added an html field to write YEP if the user=author and NOPE if not, just to check this is working OK, which it is in the attached screenshot, so I just want to apply this same logic to show or hide the edit / delete (which is inside this row:
    <td class="cbResultSetActionCell cbResultSetData"> The only other way I can think of to do this is to completely hide the edit / delete section, and then add a new one in, in the html field where I've currently got the YEP/NOPE. But I don't know what custom link needs to go in there for edit and delete, or if this can even be done in the same way you can add a custom save / delete button in a datapage.
    Any help would be much appreciated!
    Many thanks
    Nikki 

  9. Like
    Harbinger reacted to TsiBiRu in Client Database Configuration   
    Hi @kpcollier
    No worries, it is always my pleasure to help anyone in this community.
    You can try to use the code below, I've added two HTML blocks on my Tabular Report Datapage.

    1st HTML Block is to display the drop-down
    <!-- I've set the ID to the ID of the records so that we will pass the selected value from the drop down where the button is clicked--> <select id='[@field:kpcollier_Client_ID]'> <option value="[@field:Primary_Client]">[@field:Primary_Client]</option> <option value="[@field:Additional_Client]">[@field:Additional_Client]</option> </select> 2nd HTML block is to create a custom button to get the selected value of the  selected value from the drop-down of each respective row

    //I've passed the ID of the row as a parameter to our function <button type="button" onclick="myFunction([@field:kpcollier_Client_ID])">Click me</button> <script> // Received the ID, and store it on the variable x function myFunction(x) { //This code will get the selected vale from drop-down and store it to strUser variable var e = document.getElementById(x); var strUser = e.options[e.selectedIndex].value; // This code will redirect it to your prefered site via query string window.location.replace("https://www.google.com?val=" + strUser); } </script>  
    I've also added the exported copy of the DataPage that I've worked with so that you can import it to your account and see how it works

    I hope this helps.
    Regards,
    TsiBiRu
     
    CaspioData_2019-Apr-04_2034.zip
  10. Thanks
    Harbinger got a reaction from Perzival in Parameter   
    In between the Parameter name and the parameter field.
    Try this: <a href="[@app:TransportDetail]?ID=[@Passenger_ID]">View</a>
    Let me know if that helps.
    Cheers,
    ~ H
  11. Thanks
    Harbinger reacted to JolliBeng in dropdown and radio button   
    Hi Jess147,
    You can try to have a dropdown for your dish field and a Cascading radio button for your restaurant field.
    You may refer to the screenshot below:

    -JolliBeng
  12. Thanks
    Harbinger reacted to DefinitelyNot31337 in Generate geolocation from input fields   
    I'm so excited. I found a way to make it work even if AJAX Loading is enabled.
    Luckily, I came across Caspio 13 Impacted Areas and kudos to good guy Caspio making this AJAX Implementation customizable.
     
    previous post TL:DR? Follow this instead.
     
    To make this work:
    1.) Gey an API key here. Enable access to your domains (Website, Caspio URL and Integration URL) (You can see the last two in your Caspio Bridge > Account > Account Settings).
    2.) Create/Edit your Submission Form DataPage
    3.) Make sure 'Disable AJAX loading' remains UNCHECKED in the DataPage Data Source Section. (If you want otherwise, refer to my previous post instead.  This is not cross-compatible as of the moment).
    4.) In the Configure Fields section, Add a Header and Footer.
    4.1) Select your header, disable the HTML Editor, paste the code block below, replace y0uR_4P1_k3y_H3r3 with your API Key.
    <script type="text/javascript" src="https://lib.caspio.com/pub/jquery/jquery.js"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=y0uR_4P1_k3y_H3r3"></script> <div id="cbwrapper">  
    4.2) Select your footer, disable the HTML Editor, paste the code block below, edit the variables to correspond to your table fields.
    </div> <span id="error_message"> </span> <script type='text/javascript'> var lat_id = 'InsertRecordlat'; var lng_id = 'InsertRecordlng'; var address_id = 'InsertRecordAddress'; var city_id = 'InsertRecordCity'; var state_id = 'InsertRecordState'; var zip_id = 'InsertRecordZip'; var wrapper_id = 'cbwrapper'; var msg1 = 'Please input a valid address'; if(typeof jQuery != 'undefined'){ var cb_geocoder = cb_geocoder = new google.maps.Geocoder(); document.addEventListener('BeforeFormSubmit', function (event) { event.preventDefault(); var add = $('#'+address_id).val(); var city = $('#'+city_id).val(); var state = $('#'+state_id).val(); var zip = $('#'+zip_id).val(); if(!add || !city || !state || !zip){ alert(msg1); }else{ var full = add +','+city+','+state+' '+zip; cb_geocoder.geocode({address: full}, cbCallBack); } }); }else{ document.getElementById("error_message").innerHTML = "This Datapage require Standard Caspio Deployment for full functionality." ; } function cbCallBack(locResult){ if(locResult != "" && locResult.length>0){ var lat1 = locResult[0].geometry.location.lat(); var lng1 = locResult[0].geometry.location.lng(); lat1 = Number(lat1); lng1 = Number(lng1); $('#'+lat_id).val(lat1); $('#'+lng_id).val(lng1); $('#'+wrapper_id+' form').submit(); }else{ alert(msg1); } } </script>  
    5.) After saving this, you should be able to make this work.
     
    Basic Troubleshooting:
    > Check your Console by doing a Right-Click > Inspect in your browser.
    NoApiKeys: You forgot to add your key in the script tag. Google documentation here ReferrerNotAllowed: Check if the domain of your webpage is listed in your Maps API Console (Maps JavaScript API > Credentials > (Key) > Details) There's a bunch of other warnings/errors but I think the first two are the most common and critical. > Feel free to reply to this thread if you encounter problems.
     
    Note: This is not a full-fledged fix. I know I skipped adding the WebForm AppKey.  Let's just wait for the official Caspio documentation updates.
     
    Regards,
    DN31337
  13. Thanks
    Harbinger reacted to LunaLovegood in Connect to Google Drive   
    Hello @directrix,
     
    I got this same error and contacted their support team. Then advised me that this is a Google issue as they have made changes recently. But if you have an existing task that is connected to Google Drive, it'll work perfectly. Fret not, Caspio DevOps team is now looking for a way to make this work. *winks*
  14. Like
    Harbinger reacted to ministry in maintain user session across multiple pages   
    Hello,
    I'm just trying to figure out how Caspio authentication method works. 
    So far, I've read the documentation, in particular:
    - https://howto.caspio.com/authentications-and-connections/authentication/
    - https://howto.caspio.com/authentications-and-connections/authentication/create-a-standalone-login-screen-2/, 

    Let's say that I have a multi page PHP website (on my own server), with a public sections and a protected one; users should authenticate using Caspio APIs.
    Each user can be "normal" or "admin" type and, according to this, he can access different pages and will be presented with a different user interface.
    So, I should manage user's data as session variables, and the best solution would be using a Rest API (https://howto.caspio.com/web-services-api/rest-api/authenticating-rest/), but I understand that it's not supported by my "Basic plan".

    I could use the "Standalone login screen" but I should somehow "intercept" the datas and store them into a cookie, but it is an overcomplicate solution... so probably there's something I'm missing.
    How can I achieve this?

     
  15. Like
    Harbinger reacted to Vitalikssssss in maintain user session across multiple pages   
    Hi @ministry,
    You can achieve the desired functionality with standard functionality of Caspio.
    You need to create a separate authentication for each user group: "Normal", "Admin" and use this authentication on Datapages which are relevant to each group. You may check this video for more insights:
    https://www.youtube.com/watch?v=YEzM1c624Jk
    Hope this helps.
     
    Regards,
    vitalikssssss
  16. Like
    Harbinger reacted to skywalker in Javascript accesing the Authentication field   
    Thansk for your help. I managed to solve with the following solution....
    1.Inserted a virtual field into the datapage form
    2. set form element to hidden
    3. select 'authenticated field' as the default value, and select the correct 'username' field from the fields list.
    4. Changed the text in my code to the follwoing...

    </div> <script> function gup( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } var Tradesman_param = gup( 'Tradesman' ); var bride = document.getElementById("cbParamVirtual1").value; var newURL = "http://tozak.org/mywedding/wp-content/themes/life-collage/scripts/onPostJob.php?fname=brideQuoteRequest&username=" + bride + "&Tradesman=" + Tradesman_param; window.location=newURL; </script>
  17. Like
    Harbinger reacted to ChrisJ in Javascript accesing the Authentication field   
    Hello, skywalker
    I'm trying to answer your question.
    First, try to remove "e" from your code: authefield:Username -> authfield:Username
    Second: if this not helps, may be VIrtual field is a solution for you. You add a virtual field (just like HTML block) into your WebForm and set up that virtual field receives parameter from "Username" field. You create "display only" form element and it's value the same as you want (Username). Give it the label naming "Username" and your user sees the same Display Only field with expected value.
    As far as I know, Virtual field value can be accessed via "getElementByName" function. This is not standard JavaScript function, but you can see, for example here: http://msdn.microsoft.com/en-us/library ... 85%29.aspx. The first (and the only) element returned by this method will be the one you need.
    Hope one of these methods helps.
  18. Thanks
    Harbinger reacted to caspio in JS Guide: Caspio Form Elements   
    JavaScript Tips: Caspio Form Elements
     
    JavaScript is a client-side scripting language that is commonly used in HTML pages. JavaScript can be used in Caspio Bridge DataPages to extend capabilities outside the standard features. This page provides a guideline for referencing Caspio form elements using JavaScript. It is an advanced topic and you should have prior knowledge of JavaScript programming.
     
    Referencing Caspio Form Elements
     
    A common way to access a form element using JavaScript is by referencing the element's ID attribute using:
              -   document.getElementById("id")
    The value in the field can be referenced using:
              -   document.getElementById("id").value
    In the following sections, we will list the ID attributes for Caspio form elements in various DataPages.
     
    Submission Forms
    Text Field/Text Area/Dropdown/Checkbox/Listbox/Hidden:           -   InsertRecordFIELDNAME
              -   FIELDNAME should be replaced with your field name.
              -   For example: document.getElementById("InsertRecordFirst_Name")
    Radio Button: A radio button includes multiple options and each option has an associated ID. The ID is a name followed by a number:           -   InsertRecordFIELDNAMEX
              -   X is the radio button option order, which starts at 0 and increments based on the order of each radio option.
     
             For example if your radio button has three options: Red, Blue, Green
              -   Red is InsertRecordFIELDNAME0
              -   Blue is InsertRecordFIELDNAME1
              -   Green is InsertRecordFIELDNAME2
    Virtual Field: cbParamVirtualX           -   X is the virtual field in the form, which starts at 1 and increments based on the number of the virtual fields in the form.
              -   For example: document.getElementById("cbParamVirtual2") is referring to the second virtual field.
    Cascading Dropdown: Cascading dropdown and its parent dropdown are referenced by name since the ID changes on every page load. To reference cascading dropdown and its parent dropdown, use the following format:           -   document.getElementsByName("InsertRecordCompany_Name")[0]
              -   Note that in the above format, the number 0 never changes.
    Display Only: These are not fields but span tags, therefore they don't have an ID. Details and Update Forms
     
    Details and Update Forms use the same rules and naming conventions as Submission Forms (in previous section), except that InsertRecord is changed to EditRecord.
              -   EditRecordFIELDNAME
              -   For example: document.getElementById("EditRecordFirst_Name")
              -   Note that Virtual Fields and Display Only rules are the same as Submission Forms (in previous section).
     
    Search Forms
    Text Field/Text Area/Dropdown/Checkbox/Listbox/Hidden:           -   ValueX_Y
              -   X is the form element order, which starts at 1 and increments based on the order of the element in the form.
              -   Y is the criteria. It starts at 1 and increments based on the criteria order. It is always 1 if the field has no extra criteria.
    Radio Button: ValueX_Y[Z]           -   Z is the radio button option order, which starts at 0 and increments based on the order of the each radio option.
    Virtual Field: The rules are the same as Submission Forms (in previous section) Cascading Dropdown: This element should be referenced by name as explained in the previous section. The name of the element is ValueX_Y. Distance Search By ZIP/Postal Code:           -   Center of Search: cbDsField1
              -   Distance: cbDsField2
    Distance Search By Coordinates:           -   Center Latitude: cbDsField1
              -   Center Longitude: cbDsField2
              -   Distance: cbDSField3
     
    Authentication/Login Forms
    Text Field: xip_FIELDNAME           -   FIELDNAME should be replaced with your field name.
     
     
    Referencing Forms
    To access Caspio Forms/DataPages, you can reference the ID using:           -   document.getElementById("caspioform")
     
    Note that all Caspio DataPages share the same id as "caspioform". Therefore if there are multiple DataPages deployed on the same page, you need to reference them in a different way such as:
     
              -   document.forms[X]
     
    X starts at 0 which refers to the first form on the page and increments based on the order.
     
    To access Caspio Authentication or Login Forms, use:           -   document.getElementById("xip_DataSourceName")
              -   Replace "DataSourceName" with the name of data source used in your Authentication.
     
     
    Referencing Buttons
    Submit Button: Submit Update Button: Mod0EditRecord Delete Button: Mod0DeleteRecord Search Button: searchID Back Button: Mod0CancelRecord Login Button: xip_datasrc_DataSourceName           -   Replace "DataSourceName" with the name of data source used in your Authentication.
     
    Where to Place the JavaScripts
     
    In Forms, place your code in an HTML Block. The HTML Block should be the last element in the list.
     
    In Results, place the code in the Header or Footer unless you want the code to be executed for every record.
     
    Quick Tips
     
    If you need to reference an element that is not listed in the above document, try using F12/Developer Tools available from most browsers such as IE, Firefox, and Chrome. Developer Tools help web developers inspect the elements on the web page to find the related ID and also debug JavaScript code if necessary using the Console tab. For more information, check online for available tutorials using your browser's Developer Tools.
    In the meantime, you can see examples of JavaScript solutions in the community forum.
  19. Thanks
    Harbinger reacted to BaySunshine in Fixing concatenate function in JS code   
    Hi @Heineperson, 
    Caspio has stopped supporting onsubmit code:  https://howto.caspio.com/release-notes/caspio-bridge-13-0/13-0-impacted-areas/
    Please try the following fix:
    <SCRIPT LANGUAGE="JavaScript"> document.addEventListener('BeforeFormSubmit', function (event) { var x0 = document.getElementsByName("EditRecordassociatedSpecies")[0].value; var x1 = document.getElementsByName("cbParamVirtual2")[0].value; if (x0 && x1) {  document.getElementsByName("EditRecordassociatedSpecies")[0].value = x0+"; "+x1; } else {   document.getElementsByName("EditRecordassociatedSpecies")[0].value = x0 + x1; }  }); </SCRIPT>
  20. Like
    Harbinger got a reaction from Perzival in How to display information based in a yes/no field in reports DP   
    Hi @Perzival
    I want to share with you the article of Caspio : https://howto.caspio.com/tech-tips-and-articles/common-customizations/how-to-create-an-approval-process-for-new-submissions/
    I hope this helps.
     
    ~ H
  21. Like
    Harbinger reacted to DefinitelyNot31337 in Put the topmost record of a group in the corresponding collapsible row   
    Hello once again TroubleShooter,
     
    You ask such challenging/brain-teasing problems. Luckily I had my power-ups tonight and I am up for this challenge.
    I am able to find a somewhat viable solution.
     
    I hope the code speaks for itself too. *kidding*.  So paste>modify these code snippets in their respective places. Make sure that HTML Editor is disabled from the advanced tab.
     
    Note: This only works for Level1 Grouping and it works best if you put the title (i.e. details) field in the end. I need more time to customize this solution further. 
     
    Header
    <script> var init = []; var temp = (new Date).toLocaleString() + "1AmD3f1n1t3lyN0t31337!"; function comparaPush(groupByField, titleField) { if (temp != groupByField) init.push(titleField); var temp = groupByField; } </script>  
    HTML Block (*modification needed) [Regarding placement, there's only one room for error. 1/#OfFields]
    <script> var groupByField = "[@field:category]"; //This is your Grouping Field var titleField = "[@field:details]"; //And this is your Title Field. The one that you'd be putting on your collapsible row comparaPush(groupByField, titleField); </script>  
    Footer
    <script> var groups = document.querySelectorAll(`[data-cb-name="group1"]`); groups.forEach(rowalize); function rowalize(elem, idx) { elem = elem.firstChild; elem.colSpan-=1; elem.insertAdjacentHTML('afterend', `<td class="cbResultSetGroup1Label cbResultSetGroup1LabelCellNumberDate">${init[idx]}</td>`) } </script>  
    Hope this works for you. Happy Hacking!

    Cheers,
    DN31337
  22. Thanks
    Harbinger reacted to kpcollier in What is the best browser to use for Caspio?   
    Have you tried clearing cache/cookies? Try that and see if it still persists. The old version of a datapage should not even be saved unless you have the right Caspio Plan. 
    I have been using Google Chrome with Caspio for about a year, but have also tested my work on Firefox, IE, and Edge. They are all compatible on my end. 
    Make sure you have the updated datapage deployed and try viewing it through the deploy URL instead of the Preview button.
  23. Thanks
    Harbinger reacted to DefinitelyNot31337 in Export unavailable   
    Hello everyone,
     
    Not to confuse Tasks with Scheduled Tasks (aka Datahub).
    While both objects are tasks and runs as scheduled (pun. haha!). I believe Harbinger is referring to Tasks, a new Bridge feature introduced in Caspio Release 15.

     
    If you have tasks on a certain app, then you can't export it from the Homepage :<
  24. Thanks
    Harbinger reacted to Heather in Passing Parameter   
    I also tried the code, it really works!
    Thanks Harbinger! 
  25. Like
    Harbinger reacted to NailDyanC in Source in HTML DataPage   
    Hi,
    May I clarify if you are referring to the source of an HTML DataPage?  Unfortunately,  there is no data source in the HTML page, it is made by default.  You can use it to implement pages using HTML and CSS.
×
×
  • Create New...