Jump to content

Search the Community

Showing results for tags 'conditional'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Caspio Bridge
    • Caspio Apps for Ukraine
    • General Questions
    • Caspio JavaScript Solutions
    • Tables, Views and Relationships
    • Import/Export and DataHub
    • DataPages
    • Deployment
    • Security, Authentications, Roles, SAML
    • Styles and Localizations
    • Parameters
    • API and Integration
    • Calculations and aggregations
    • User JavaScript and CSS Discussions

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location


Interests

Found 20 results

  1. I'd like to add some HTML to my Datapage to conditionally change the color of a report's background and text color based on the value of a calculated field. This field finds the number of days left until a project is due. I'd like to change the text color of this field to red and the background to yellow if it is past due (if the days left are negative). I know there are a couple of other pre-existing threads on this topic but for some reason I am having no luck. I pasted these in the source of my header but they had no effect. Let me know if you see anything wrong with my formulas: //for the background <a id="visi[@calcfield:1#]"> <script> var isi = document.getElementById("visi[@calcfield:1#]"); if(isi < 0){ isi.parentNode.parentNode.style.backgroundColor = 'red'; } else{ isi.parentNode.parentNode.style.backgroundColor = '#NoColor'; } </script></a> //for the text <div id="mydiv[@calcfield:1#]"> </div> <SCRIPT LANGUAGE="JavaScript"> if ("[@calcfield:1#]" < "0"){ document.getElementById("mydiv[@calcfield:1#]").innerHTML ="<span style='color:red;'> [@calcfield:1#] </span>"; } </SCRIPT>
  2. I have a table with a field named Total_Time with a function datatype, that calculates total time using the flowing formula.. Round(((([@field:End_Hour] - [@field:Start_Hour]) * 60 + ([@field:End_Min]-[@field:Start_Min])) - (([@field:Break_Fin_Hour] - [@field:Break_Start_Hour]) * 60 + ([@field:Break_Fin_Min]-[@field:Break_Start_Min]))) /60 ,2) This works as expected… Now I would like to add a conditional statement that checks the value of the field "Assigned_Tech" and if the value is “Summary” then leave the Total_Time field blank, else run the formula. Im thinking.. CASE IF ([@field: Assigned_Tech])!==”Summary” THEN Round(((([@field:End_Hour] - [@field:Start_Hour]) * 60 + ([@field:End_Min]-[@field:Start_Min])) - (([@field:Break_Fin_Hour] - [@field:Break_Start_Hour]) * 60 + ([@field:Break_Fin_Min]-[@field:Break_Start_Min]))) /60 ,2) END Can someone please help me with the correct case statement to use. I spent 2 days writing the total_time formula and now am in a bit over my head using conditional statements in the formula. Thanks in advance for any an all help
  3. I have a table of docents who are in one of two programs (art or garden). The docent logs in with authentication. After logging in, the docent sees a tabular report of all lessons they have signed up to teach. Is it possible to customize the header with javascript so it contains the graphic (logo) specific to the art or garden program?
  4. Hi everyone, I'm fairly new to the world of JavaScript and have the following scenario on a submission page: During submission, my users select a business client using an AutoComplete field. Once they selected a client, two virtual fields pull two values for this client from an external table. These lookups are set up using cascading text field. On the same DataPage, there is a radio button with two options. Should the two virtual fields remain blank (basically meaning that there is no value for either of the fields for this client in the external table), the 2nd radio button option should be selected and the field hidden to prevent user interaction. The hiding and selection part works fine, but it seems that I'm not able to get the value from the virtual fields and my script stops working as soon as I add the condition that involves the value of any of the two virtual fields: <script type= "text/javascript"> function AMFCheck() { var AMF1 = document.getElementById('cbParamVirtual12')[0].value; var AMF2 = document.getElementById('cbParamVirtual13')[0].value; if (AMF1 == "" && AMF2 == "" ) { document.getElementById("InsertRecordAMF_payable1").checked = true; document.getElementById("InsertRecordAMF_payable").style.display = "none"; } } document.getElementById("caspioform").onchange=AMFCheck; </script> I'd be really grateful for any help. Thanks, Christof
  5. I am trying to conditionally show/hide HTML elements based what type of user is logged in. I’m not too familiar with how Caspio sessions are handled and how they relate to my HTML pages. I also have very little Javascript experience. There should be three levels of access, Admin, Manager, and User. I currently have an authentication table that has three users and three yes/no fields (admin/manager/user), each user is a different type. My first idea was to use cookie data. On successfully logging into my authentication form it would make a cookie for user type which would have a value of admin, manager, or user. Then I could use that cookie to add the display:none style to certain elements that I don’t want lower access users viewing. My problem is that I’m not sure how to do that with Javascript, or if that is the best practice. I currently have an HTML Datapage linked to my Authentication. On that page is this code: var type_admin = '[@authfield:admin]'; var type_manager = '[@authfield:manager'; var type_user = '[@authfield:user]'; if (type_admin == "Yes") { document.cookie="type=admin"; } else if (type_manager == “Yesâ€) { document.cookie="type=manager"; } else if (type_user == “Yesâ€) { document.cookie="type=user"; } Then I assume I would just reference the cookie on my HTML pages somewhat like this: <div class="adminContent"> Show this content if the user is Admin </div> <div class=â€managerContentâ€> Show this content if the user id Manager </div> <div class=â€userContentâ€> Otherwise show this content </div> Here are the HTML/PHP files I’m working with: http://domco.us/vita/test/ And here is the login page that’s just an embedded Datapage: http://domco.us/vita/page_login.php In the end I would like to be able to filter things like navigation buttons or div blocks. It would be great to have an Admin Tools link in the navigation that only Admins/Managers could see. I’m not sure the specifics of getting something like this to work. Also I don’t know how to keep that @authfield data throughout different HTML pages (not linked to Caspio) and I’m just assuming Cookies are the best option. Any help would be greatly appreciated.
  6. Hello, I am trying to set up a form that would allow users to register, and give them the option to pay immediately or if they prefer they can skip paying now. I tried using a conditional rule to hide the payment unless the user has indicated they do want to pay immediately. But the payment form still appears despite the conditional rule, I am guessing it's because all the payment fields are required and this cannot be changed. So i tried instead making a single record update form for the payment, but it seems this is not possible either, after creating a single record update datapage, the 'insert' button does not include the 'payment' option. So the only solution I have thought of is 1. have the registration form collect their contact information and choice of whether to pay now or later. 2. Make the destination of the registration form be a separate payment form if they have chosen to pay now, and pass a unique ID from the first form submission as an external parameter to the payment form. These users will not be authenticated so I am concerned that if the only thing linking the first form with the payment form is an external parameter, there may be instances where that parameter value is accidentally deleted or missing, resulting in a payment but no indication of who it was from. If anyone has a suggestion for another way to approach this please let me know. thank you!
  7. I have several sections in my submission form that I cannot use in my new Rule. They do not appear in the Action list. Can someone help?
  8. Hello, I've been working with Caspio for a while now (Although I haven't done any real coding before), and I'm having trouble getting the coding right for something in a tabular report. I have a report with roughly twenty fields and thousands of records. I have a yes/no field that determines whether records have been reviewed by an employee (they toggle it themselves). I'm attempting to set it up to color code the records or even specific fields for that to make it easier to see if things have been dealt with or not. This is the link I found that seemed to have what I needed. I don't have any experience with Javascript so if I'm making an obvious mistake I'm unaware of it. https://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-dynamically-change-the-background-of-a-results-page/?_ga=2.268956409.901822134.1565024539-1632853601.1563754793 This is the code I've set up in an alternate HTML block based on the guide. We have an autonumber field 'Encounter_ID' and a yes/no for 'Needs_Review' [@field:Needs_Review^] <a id="visi[@field:Encounter_ID]"> <script> var isi = document.getElementById("visi[@field:Encounter_ID]"); if('[@field:Needs_Review]' == 'Yes'){ isi.parentNode.parentNode.style.backgroundColor = '#FF9999'; } else{ isi.parentNode.parentNode.style.backgroundColor = '#AAFAFA'; } </script> My issue is that when I input the code, it shows the entirety of it typed out without making any changes to the color. If anyone could explain what I'm doing wrong, or suggest an alternative way to accomplish this, please let me know. I would greatly appreciate it. Thanks in advance! - Ryan
  9. i have a primary key ID and several other fields: locatio, customername, crew, etc and a field called datecompleted. when the date completed field has a value I want to change all the other field to a color "red" any help would be appreciated. Isuck at coding.
  10. I've found a number of sort of related posts on this but nothing exact that I need. I have a tablular datapage with an internal Details page option that sends an Acknowledgement email for Update/Insert records. Works well except I need the user to be able to 'choose' whether to send the acknowledgement (or notification) email by checking a virtual field (check box). This is so an email doesn't go out every single time there's an edit- it only needs to go out when the users decides to by checking the virtual field. I'd like to possibly be able to use something like this on: -and Inline Insert of a tabular datapage (though I don't think it could be virtual field then, perhaps I could put a check box in the data source table) -a Bulk Edit popup But the Details form of a tabular datapage is the first place I need to start. This seems like it should be a standard feature of CB because email notifications shouldn't go out every time an edit is made unless desired. Any help on this would be great- thanks.
  11. I have a HTML datapage which is the user' s main menu to my app. Now I would like to test whether the user is restricted in it's use of the first of four menu items. I have the following code, but it returns "file or directory not found" when I preview it and choose the 1st menu item: <script> window.onload = testFormRes; function testFormRes() { var dynLink; if ("[@authfield:Restricted^]"=="yes"){ dynLink="https://c0ect240.caspio.com/dp.asp?AppKey=eeda30004146e1be17fe4f64a319"; } else{ dynLink="https://c0ect240.caspio.com/dp.asp?AppKey=eeda3000a155f226d27146b0ae20"; } } </script> <div id="menu-mobile"> <div id="row"> <h1><i>[@authfield:Cust_Name]</i></h1> <h2>Main Menu - Res</h2> </div> <div id="row"> <div id="mobileNavagtion"> <ul> <li><a href=("dynLink") class="btnPatrolForm">ActivityForm</a></li> <li><a href="https://c0ect240.caspio.com/dp.asp?AppKey=eeda3000a31708e7da464d9e9b63" class="btnPostOrders">Post Orders</a></li> <li><a href="https://c0ect240.caspio.com/dp.asp?AppKey=eeda3000d7e592f401a541d4b948" class="btnReportsMain">Reports</a></li> <li><a href="https://c0ect240.caspio.com/folderlogout" class="btnLogout" class="btnLogout">Logout</a></li> </ul> </div> </div> </div> As one can probably detect, I am a novice at coding, any help would be appreciated! Richard
  12. I want to make a datapage element be visible or hidden depending on the value of another datapage element. How to do?
  13. How can I show an error message if the amount entered in a submission page is less than a certain value?
  14. I have a submission form that cascades data results in several virtual fields. The virtual fields reside within sections that either hide or display those elements depending on their results. What I would like to do is have all the elements that are not hidden display on the same line. Unfortunately only the elements within each section have the advanced option to “continue next element on the same line”. Is there a way to display all elements and submit button all on the same line? I tried removing the sections thus allowing me to display all elements on the same line, but with some elements being hidden the table that displayed the elements would jump around. For example.. if virt1,virt4, and virt5 are displayed on a search, then on the next search virt4 and virt5 were hidden and only virt1 and virt15 are displayed, virt15 is displayed on the far end several spaces away from virt1. Providing an undesirable result of the table cells jumping around with each search.
  15. I am creating a datapage where my clients can make request for the time and date of a specific inspection. In order to be able to coordinate the inspectors I have to limit the time that the requests are made, therefore I need to create a condition that does the following: to process the request online then the request has to be made at the latest the prior business day before by 5:00 pm (local time) For example today is Tuesday at 6:00 pm local time, therefore the earliest inspection available is for Thursday since is already after 5:00 pm to request for tomorrow. I am intermediate user that have created a significant application but I don't have programming knowledge, so any help is really appreciated.
  16. Hello, I have a Search and Results web page (simular to what is described here.. http://howto.caspio.com/tech-tips-and-articles/parameters/add-a-search-interface-to-results-sets-page ). The web page has a search submission form and two different results data pages (report1 and report2), both results pages receive parameters from the submission form and display tabular reports on the web page as expected. So far so good. The first virtual field in the submission form is a dropdown that offers the selections "report1 and report2, passing that parameter as [@report] on exit. How can I display/hide the results pages depending on the [@report] parameter received. Any and all suggestions are greatly appreciated.
  17. Can anybody tell me what I need to do to make data entry into an input field conditional on a checkbox being check or not? I have a service parts catalogue table in my app. When users key in a new part code into the input datapage they have to check a checkbox (or not) to indicate whether the part code is serviceable or not. If serviceable, then I would like to force them to have to enter a from and to date. How can I enforce this? Any help would be much appreciated
  18. ok I am really hoping someone can help on this one... it seems easy I just can't seem to get it! I have a conditional field (PO) that based on a flag is hidden (RequirePO flag when set to false the PO field is hidden), but what I really want to do is if the flag is false hide the field, if it is true require the field.... It look like the rules in Caspio can either hide it or require but I cant do both (I even tried setting two rules but it looks like if you use a field in a rule it cant be used again)... maybe a javascript solution?
  19. Hi guys, i need a small help! I'm passing a var data to an html page trough this script: var data = { registry: "[@authfield:registry^]", }; [@authfield:registry^] is a checkbox field, so it returns YES/NO. Now i need a more complex code. I would like to set something that do it: if { ([@authfield:registry^]= Yes & [@authfield:record^]= Yes) registry= Yes} else { registry = No } May somebody help me to fix this code? Thanks in advance Ezio Grieco
  20. When user selects a specific title from a dropdown I want to send a specific email to him. How can I do that?
×
×
  • Create New...