Jump to content

Mathilda

Caspio Rockstar
  • Content Count

    464
  • Joined

  • Last visited

  • Days Won

    49

Posts posted by Mathilda

  1. On 2/21/2017 at 8:02 AM, moksamedia said:

    Hello,

    I'm editing a datapage with multiple custom HTML elements and it would be really nice if I didn't have to "finish" after each changed to test it on my server (bc this then throws me out of the datapage I'm editing and I have to re-select and and navigate back through the wizard to the right page to edit). 

    Is there a way to save a datapage I'm working on without clicking the "finish" button?

    Thanks,

    Andrew Hughes

    Hello Andrew,

    Why don't you use preview? It's a nice option of checking changes before saving.

    If checking on deployed datapage is mandatory due to style issues, etc, I'm afraid that you can't avoid clicking "Finish" to check changes.

  2. 6 hours ago, Hearnie said:

    Javascript help please

     

     

     

    I have a web page on which I wish to display a hyperlink depending on the status of a specific field from my authentication table.

     

     

     

    The authorisation field “[@authfield:Staff_List_Branch_Type]” has two options which are “FS” or “SIS”.  Depending on the authorisation of the user I would like to display a link that will take the user to a specific web page depending on their Branch_Type status. 

     

     

     

    So if your autfield branch type is “FS” a link will display that will take you to web page A, however if your branch is “SIS” a link will display that will take you to web page B.  There must only be one link displayed

     

     

     

    Any help or ideas greatly appreciated

     

     

     

    Steve

     

    Hi Steve,

    I would recommend using Cascading elements for this purpose, there is no need to use JS. I assume that you use type of the datapage which allows using cascading (submission, update, details forms)

    Create a virtual field and onload receive value from authentication field. Then create a look up table with two columns and two records and fill out customer statuses and URLs.

    Then add one more virtual which will be cascading text field. Use first virtual field as a parent field. If you need to redirect user to that URL after submission, use this solution

    Hope that helps

  3. 6 hours ago, diversity said:

    Hello everyone.

    Quick question.  I know I'm asking for a lot here but is it possible to create a javascript where users can upload multiple fields directly into a table?  Currently you can download a spreadsheet of your table in the Data Report portion, but I am wondering if there is a way for the user to take that exact spreadsheet, fill it out, and upload it into the same data table through a data page?

    Hello,

    I don't think that it's possible to implement that only on front end using java script. You may contact Professional Services team, I think they will be able to implement that.

    You can append data to table using manual import or scheduled import task. But it's impossible to insert more than 1 record at once though the datapage.

  4. On 2/22/2017 at 2:25 PM, alwinoei said:

    In Caspio when I do a preview (see right photo), the form i designed looks just fine, and without lines.

    After deploying the data in Wordpress (see left photo), the layout is completely different with lines etc. and very much not ok.

    How to get the exact layout as seen in Caspio preview, so without lines etc.

    Current Wordpress version: 4.7.2 (the latest)

    Plugin: Custom Database Applications by Caspio version 2.0

    What to do?

    Screenshot 2017-02-22 23.13.09.png

    Hi, 

    Style of the theme in site builder overwrite Caspio style, since you embed datapage on a webpage and elements of the datapage inherit style attributes from site builder. 

    The workaround is to deploy the datapage in iframe (not the best option if you pass parameres or redirect user after submission).

    Another option - editing style attributes of theme and removing or editing those attributes which overwrite caspio style. It easily can be found using developer tools in your browser (hit F12 to call dev.tool)

    To remove borders, insert the following code in the header of the datapage:

    <style>
    #caspioform tr
    {
    border: none !important;
    }
    #caspioform td
    {
    border: none !important;
    }
    </style> 

     

  5. 2 hours ago, abelphathost said:

    Thanks Mathilda, however am still failing to get any positive result, I have tried to use a drop down list for selection of options but am still stuck. Maybe there is something that I have to do with for my javascript to execute. I am using the following script in my footer area as suggested:

     

    <SCRIPT LANGUAGE="JavaScript">
     
    function Updatestatus()
    {
    if (document.getElementById("statuss").value=="Approve")
    {
    document.getElementById("status").value="approved";
    }
    else if (document.getElementById("statuss").value=="Undecided")
    {
    document.getElementById("status").value="pending";
    }
    document.getElementById("caspioform").onsubmit= Updatestatus;
     
    </SCRIPT>

     

    You need use EditRecord syntax before field name, in my code the following name EditRecordapproved means that the EditRecord is a part of syntax and approved is a name of the field. So you need to insert your field names instead of mine, do not remove EditRecord. Also make sure that you hit  "Source" button before inserting code in the footer.

  6. On 2/21/2017 at 4:53 AM, abelphathost said:

    Hi everybody, i need to update a field i the database when a checkbox is checked here is my code but it's not working:

    <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")="pend";
    }
    document.getElementById("update as").onsubmit= UpdateQty;
     
    </SCRIPT>

    Hi,

    I edited your code. I assume that you use details or update form. Try using the following code in the footer.

    <SCRIPT>
     
    function Updatestatus()
    {
    if (document.getElementById("EditRecordapproved").checked==true)
    {
    document.getElementById("EditRecordstatus").value="approved";
    }
    
    else if (document.getElementById("EditRecordapproved").checked==false)
    {
    document.getElementById("EditRecordstatus").value="pend";
    }
    
    }
     document.getElementById("caspioform").onsubmit = Updatestatus;
    </SCRIPT>

    You need to insert your field names in instead of approved and status, please note that Java Script is case sensitive.

    Also make sure that those fields are editable on the datapage. If you need to hide the status field, you may do that using html block

  7. On 2/18/2017 at 6:02 PM, VLE33 said:

    Hi, 

    I'm using iFrame to deploy my Caspio code to Wordpress. For example, a search page. The search page shows up nicely but I can't see the scroll bar to scroll up and down to see all the search parameters on offer unless I touch within the  iframe with my cursor. Only then the scroll bar (up/down) appears. Is there a way to have it show up permanently so a user can see it and know that scrolling is possible? Ir even better, is there a way to enlarge the IFrame so that scrolling isn't necessary. I would prefer no scrolling within the frame. I would prefer the frame just expands to the width of the content it's trying to display. It's not that much. 

     

    Thanks

     

    Hi, sure it's possible to resize the iframe. This article should be helpful 

  8. 6 hours ago, JoennAquilino said:

    Hello,

    I don't know if it's Wordpress issue but for some reason, whenever I deploy a datapage in iFrame, both wordpress code and html code, it wont receive any parameters however when using different deployment, it's working fine. 

     

    Currently I deployed the datapage using the other means but I'd prefer using iFrame on some instances. 

     

    Thank you.

    Hello,

    This is not related to Wordpress deployment.

    If you need to pass parameters , don't use iframe deployment method, since iframe is considered as a separate element on a webpage.

    So Iframe is not an option if you need to pass parameters or redirect customer to another webpage after form submission, etc.

  9. On 2/19/2017 at 4:39 PM, DataAdmin said:

    Hi Mathilda,

    Thanks a lot for the reply.

    I tried testing all the possible scripts discussed in forum and it all did not work.

    And now I know the reason why.

    Your response is what I badly needed.

    Thanks heaps.

    Ivy

     

    Hi Ivy,

    I have good news for you :)

    I was able to make it to work with jquery. Wrap your fields in div with ID cbform-improvement. Also you need to disable ajax on your report and paste the following script in the footer:

    <script>
    $("#cbform-improvement #Mod0InlineEdit").click(function(e){
    var chkbx_before = "[@field:Field_name^]";
    var chkbx_now = $("[name=InlineEditField_name]").is(':checked');
    
    if(chkbx_before!="Yes"){
     if(chkbx_now){
      var timestamp = '[@cbTimestamp]';
      $("[name=InlineEditField_for_date]").val(timestamp);
     }
     else {
      var timestamp = '';
      $("[name=InlineEditField_for_date]").val(timestamp);
     }
    }
    
    });
    
    </script>

    Don't forget to paste your field names.

  10. Just now, Mylene said:

    Hey, everyone!

    I need help again :)

    I'd like to check a checkbox when another checkbox is checked and vice versa.

    I have a submission form with virtual field. And if that field is checked I need to check the "Subscribed" checkbox field on the same datapage.

    Thanks!

    Hi Mylene,

    I have a solution for you. Use the following script in the footer of the form:

    <script>
    
    document.getElementById("cbParamVirtual1").onchange= function()
    
    {
    
    if (document.getElementById("cbParamVirtual1").checked==true)
    {
    document.getElementById("InsertRecordPublished").checked=true;
    }
    
    else if (document.getElementById("cbParamVirtual1").checked==false)
    {
    document.getElementById("InsertRecordSubscribed").checked=false;
    }
    }
    </script>

    In my script the virtual field  has index "1", because my virtual field id the first one on the datapage. You may find more info about referencing virtual fields here

    Also replace "Subscribed" with your fieldname.

  11. On 2/14/2017 at 11:13 AM, DesiLogi said:

    Is there a way to use the 'Allow users to select data using a search form' option on a tabular report but to SKIP opening the search form on 1st load of the report?

    Meaning, I'd like the user to go straight to the report's results and THEN if they want to search/filter they can click the 'Search' link and go to the search form. 

    I know how to use a separate submission form to do a search/filter but that causes a LOT of extra datapages in the app and I have to pay for those over my limit (my app is huge). 

    Also it's far more intuitive to open the full results set and then do a filter. It's clunky to have to go through a search form first to get to the results. This should be a standard option, IMO, like a check box in the wizard for 'don't open search form upon report opening.

    That said, I need a workaround. I got some basic concept for it from someone:

    "You will need to pass parameters to the URL of the resultspage for eg: showform =0 or 1

    In the configure search fields you will write a javascript to hide the form is the showform is 0, When they link to see the search form again then you will pass the parameter to say 1 then the search form JS will show the fields in the search form. " 

    I have no idea how to implement this in the report itself. If anyone has any ideas that'd be really great- thanks!

    I have an idea how you may implement that.

    - Add a virtual field to the search form, receive default value 1.

    - Hide field using html blocks, you may find solution here

    - insert the following script into the footer:

    <script>
    window.onload = function hide(){
    
    }
    var x = document.getElementById("cbParamVirtual1").value;
    if (x=="1")
    {
    if(document.getElementById("caspioform")) {
      document.getElementById("caspioform").style.display = 'none';
    document.getElementById('caspioform').submit();
    }
    }
    
    </script>

    Virtual field receives default value only on the first load, that is why search form will be hidden and auto-submitted only on the first load of the form, so if you hit "search again" link, you will be able to use search form as usual.

    Hope that helps

    Cheers! :)

  12. On 2/15/2017 at 0:44 PM, NeoInJS said:

    Hello - I need help for  custom JS to compute and display the Calibration_Due in a submission form when the user inputs the Last_Calibration date and the Calibration_Frequency

     ·         Calibration_Due = Last_Calibration + Calibration_Frequency

     Where field types are

    • Calibration_Due – date
    • Last_Calibration  – date
    • Calibration_Frequency – number of months

    Hello,

    Why don't you use formula field on the table level?

    Example of the formula:

    Dateadd(mm, [@field:Calibration_Frequency ],[@field:Last_Calibration])

    If Java script is a better option for you, you may check this post

  13. On 2/14/2017 at 4:52 PM, DataAdmin said:

    Hi

    I've tried using this on my footer but it does not work.

     

     

    My datapage is a results page with inline edit set to yes.

    Below is my script:

    <SCRIPT LANGUAGE="JavaScript">
    function setTime(){

    var v_chk=document.getElementById('EditRecordConfirmed').checked;
    if(v_chk==true)
    {
    document.getElementById("EditRecordDateConfirmed").value="[@cbTimestamp]";
    }

    }
    document.getElementById("caspioform").onsubmit=setTime;
    </SCRIPT>

    Thanks.

    Ivy

    Hi Ivy,

    As far as I know, we can't use java script in Inline edit mode. That's why I would recommend editing record on details page.

    That script should work on details page

  14. 1 hour ago, diversity said:

    Even when I put this code in, I'm having the same issues as described above.  The javascript just shows on my page and doesn't work

    You need to hit the source tab before inserting code to the footer. This article should help.

    Also don't forget to change the filed name in the code and you need to hold the Ctrl key on the keyboard while clicking on the required values simultaneously.  

    Hope that helps

  15. 2 hours ago, ChrisGoode said:

    Our database was created before formulas were allowed in tables.  Due to relationships, table restrictions and being live, I would like to fix this without using formulas.  I have a submit form that is creating a Work Order Number by concatenating the Equipment_VIN and Time Stamp.  In the form the Equipment_VIN is chosen by drop drop down from an equipment table.  The form works perfectly.  When I change the Equipment_VIN to autocomplete so the VIN numbers are easier to find the element of the VIN is no longer pulled by the script.  Anyone have an idea as to why this is happening?

     

    Here is the script I am running in the footer.  The script points to an HTML block div that is called "won" for work order number.

    <SCRIPT LANGUAGE="JavaScript">

    function concatenate()
    {

    var position1 = document.getElementById("InsertRecordEquipment_VIN").value;

    var position2 = '[@cbTimestamp]';

    var allpositions = position1 +" "+ position2;

    document.getElementById("InsertRecordWork_Order_Number").value = allpositions;
    document.getElementById("won").innerHTML= "Work Order Number is: " + allpositions;
    }

    document.getElementById("Submit").onmouseover=concatenate;
    </SCRIPT>

     

    Since Equipment_VIN is an autocomplete field, try using another syntax for getting value:

    var position1 = document.getElementsByName("InsertRecordEquipment_VIN")[0].value;

    Hope it helps

  16. 8 minutes ago, VLE33 said:

    Thanks Mathilda. 

    Is there a way the search can be saved without downloading and then re-uploading? A bit like a user saves an item to a shopping cart.

    Yes, there is an option how you may implement that. You could add a button and onclick call a submission form which will receive parameters from selected record, user ID and autosubmit itself. Then you may create a report datapage with record level security and filter only records, associated with user ID. You may deploy that report on the same page where you deployed user's profile.

    Please feel free to ask if something is not clear enough.

  17. 3 hours ago, VLE33 said:

    I have a registration set up and my users have profile pages. I also have searches set up. How can I allow a user to save the results of one of their searches to their profile. Is this possible?

    Thanks for any advice.

    Sure, it's possible. You may allow users to save data from results page. You can find more info here

    Then add a field with 'file' data type to user's table and make that field to be editable on profile page, so users will be able to upload file there.

  18. On 2/4/2017 at 0:50 AM, SNMCStrategicSupport said:

    Would there be a way to do this and hide results page fields?  I have a report that produces editable fields; but I want to set a rule that if an auth field is not equal to a field in the table, I want them to see but not be able to edit.

    Worst case, I'd take just hiding the field all together...

     

    EDIT: for clarity - instead of hiding by identifying the <div> I want to perform the function by identify a results field as seen in the picture.

    Capture.JPG

    I don't see an option to restrict editing on results page. For example inline edit links have the same class for each Id. 

    As a workaround, we can compare info in auth field to field value and if those values are equal, we can provide a link to a separate details page, where you will be able to edit the record. 

    Add an html block to your report, disable editor and paste the following script:

     

    <script>
    if ([@authfield:Field_name] ==[@field:Field_name]) {
    document.write('<a href="URL_Of_details_page?ID=[@field:ID]">Edit record</a>');
    }
    </script>

     

    Paste your fields instead of [@authfield:Field_name] and [@field:Field_name]

    Also you need to paste your URL with parameter instead of: URL_Of_details_page?ID=[@field:ID]

  19. On 1/27/2017 at 11:51 AM, Pulford said:

    I'm working on my last issue in my program. Does anyone have a script for this:

     

     I have a radio box filled with two options. I also have a second hidden field. 

     

    If the first radio option is picked, I want the hidden field to get a value of A. If the second radio option is picked, I want the hidden field to get a value of B. 

     

     The radioboxx field has its own value that it gets, so that hidden field is separate,  but I wanted to bill based on which selection is made. 

     

    Thanks

    Mark

    Hi Mark,

    I found out the following solution. I suppose that you have a submission form.

    Create a separate lookup table and for each value in radio button assign needed value.

    E.g. field1       field2

           value1       A

           value2       B

    Then make hidden field to be cascading text field, use radio button field as a parent field, use recently created table as a datasource, also filter  values on field1. I'm attaching a screenshot.

     

    If you need to hide cascading field, you may do that using html blocks. 

    child.png

  20. On 1/26/2017 at 7:32 PM, DesiLogi said:

    I found this code that is almost there. It requires the user to type in the word "Delete" into a virtual field though:

    
    <SCRIPT LANGUAGE="JavaScript">
    
    document.getElementById("Mod0DeleteRecord").style.display = 'none';
    
    function MyFunction()
    {
    
    var stat=document.getElementById('cbParamVirtual1').value;
    
    var del = "Delete";
    if(stat==del)
        {
     
      document.getElementById("Mod0DeleteRecord").style.display = 'initial';
    
        }
    else 
    
        {document.getElementById("Mod0DeleteRecord").style.display = 'none';
    
         }
     }
    
    
    document.getElementById('cbParamVirtual1').onchange=MyFunction;
    
    
    </SCRIPT>

    I need the code to look up an existing field (not a virtual field, and it's a number field) and see if that field is null or not. If the field = null then I need to hide the Delete button, if field = not null then I need to show it. I've tried messing around but can't seem to get it to work. But the above code should be a good place to start if someone has a bit of expertise to give. 

    Hi, I edited code, which you found. The Delete button will be hidden if value in the field is blank. Please note, field should be editable on details page, if you don't want to display the field on the datapage, you may hide the field using html blocks

    <SCRIPT LANGUAGE="JavaScript">
    
    function MyFunction()
    {
    
    var stat=document.getElementById('EditRecordField_name').value;
    
    if(stat.length>=1)
        {
     
      document.getElementById("Mod0DeleteRecord").style.display = 'initial';
    
        }
    else 
    
        {document.getElementById("Mod0DeleteRecord").style.display = 'none';
    
         }
     }
    window.onload=MyFunction;
    
    
    </SCRIPT>

    Paste your field name instead of Field_name

    Also I see that you were looking for the html code of delete button: 

    <input class="cbDeleteButton" id="Mod0DeleteRecord1" name="Mod0DeleteRecord" type="submit" value="Delete" />

    In case if you decide to use rules, you may use that code.

    Hope that helps!

  21. On 2/10/2017 at 4:46 PM, DesiLogi said:

    Thought others might find this useful. If you have a complicated table (using separate html blocks for the tr,td, etc) set up in a Details report you're unable to use Rules to show/hide sections. Because if a Section is inside the overall table (between the html blocks with table,tr,td) then when hidden it hides the entire table and therefore all of your fields within it. This is really a problem in terms of being able to have 'smart' reports. 

    A workaround is to put a div in an html block and then show/hide it based on whatever criteria you would have used in a Rule. In this example that would be using a field that's a number and judging if it's null/not-null. 

    So instead of a rule use 2 divs to show/hide what you want. The 1st div has it's own objects (and you could put virtual fields, regular fields, buttons, etc within it) and the 2nd div shows different objects (or it could just be text or blank if desired). 

    Here's what to do:

     

    The field for the criteria needs to be on the results list and in this example is a number value, set to 'Hidden.'

     

    In an html block uncheck the html editor.

    Use section id's for the divs:

    <div id="section1">Objects specific to this div</div>
    <div id="section2">Objects specific to this div, or blank if desired</div>

     

    Then in the footer put your code:

    <script>
       var v_divhideid = parseFloat(document.getElementById("EditRecordMyFieldName").value);

    if(!isNaN(v_divhideid))
    {
      document.getElementById('section1').style.display = "block";
      document.getElementById('section2').style.display = "none";
    }
    else
    {
      document.getElementById('section1').style.display = "none";
      document.getElementById('section2').style.display = "block";
    }
    </script>

     

    This enables you to show different objects depending on the value of a field, like a Rule, but using divs instead. 

     

    Thanks for sharing!

  22. On 2/6/2017 at 7:59 PM, jgfeller said:

    I am attempting to change the background color in a report search results page using an IF function.  I tried to use the following code but for some reason it does not work.  I am sort of new at this so I may just be missing something obvious but I cannot find it.

     

     

    
    <script>

     

    
    
     

     

    
    var isi = document.getElementById("visi[@field:id#]");

     

    
    
     

     

    
    if ([@calcfield:1#] > 6){isi.parentNode.parentNode.style.backgroundColor = '#58ff33';}

     

    
    
     

     

    
    else if([@calcfield:1#] <= 6 && [@calcfield:1#] >= 4){isi.parentNode.parentNode.style.backgroundColor = '#ffac33';}

     

    
    
     

     

    
    else if([@calcfield:1#] < 4){isi.parentNode.parentNode.style.backgroundColor = '#ff3b33';}

     

    
    
     

     

    
    </script>

     

     

     

    You need to use string parameters, so try removing # symbol in parameter names, also make sure that you inserted opening div tag in html block above all the fields and closing div tag below all the fields. Also I would recommend removing if in the last condition. Use else instead of else if.

    You may take a look at the code I use on my datapage:

    html block1 above all the fields: 

    <div id="visi[@field:id]">

    html block2 below all the fields:

    </div>
    <script>var isi = document.getElementById("visi[@field:id]");
    
    if('[@field:Sales]' >=1000)
    
    {isi.parentNode.parentNode.style.backgroundColor = 'green';}
    
    else
    
    {isi.parentNode.parentNode.style.backgroundColor = 'red';}
    
    </script>

     

×
×
  • Create New...