Xiang
Caspio Guru-
Posts
75 -
Joined
-
Last visited
-
Days Won
9
Xiang last won the day on May 28 2016
Xiang had the most liked content!
Recent Profile Visitors
Xiang's Achievements
-
JEllington reacted to an answer to a question: Formatting Date In Calendar Popup
-
How To Add One Month To An Entered Date With Js?
Xiang replied to Cameron's topic in User JavaScript and CSS Discussions
Hi Cameron, How are you? I think, you can use the following script: <SCRIPT LANGUAGE="JavaScript"> function setDate() { var firstDateFieldName = "first"; var secondDateFieldName = "second"; firstDateFieldName = "InsertRecord" + firstDateFieldName; secondDateFieldName = "InsertRecord" + secondDateFieldName; var f_Date = document.getElementById(firstDateFieldName ).value; var first_Date = new Date(Date.parse(f_Date)); var result_Date = new Date (first_Date.setMonth(first_Date.getMonth()+1)); var d_month = result_Date.getMonth() + 1; if (d_month<10) {d_month = "0" + d_month;} var d_day = result_Date.getDate(); if (d_day<10) {d_day = "0" + d_day;} var d_year = result_Date.getFullYear(); var str_date = d_month + "/" + d_day + "/" + d_year; document.getElementById(secondDateFieldName ).value = str_date; } document.getElementById("caspioform").onsubmit=setDate; </SCRIPT> Let me know, if something doesn't work. -
Multi Select Listbox On Bulk Update Form
Xiang replied to Cameron's topic in User JavaScript and CSS Discussions
Hi Cameron, How are you doing? If you want only to allow multi select, I think, the following code should help (enter it in the Footer of your Bulk Update screen): <SCRIPT LANGUAGE="JavaScript"> /* "fieldName" is the variable name for the listbox type form element field. */ var fieldName = "ENTER NAME OF YOUR FIELD"; fieldName = "BulkEdit"+fieldName; var x=document.getElementsByName(fieldName); x[0].multiple=true; </SCRIPT> Have a great day! -
Capitalizing All Letters
Xiang replied to pilotexpressions's topic in User JavaScript and CSS Discussions
Hello Logan, I checked with numbers also. Please note, that you should add a Header&Footer element, select the Footer element, click the Source button (or disable HTML Editor) and enter the code. If you enter the code before the field, script cannot work. Please also note, that the name of the field must be the exact same as in Table design. Please verify, that it's a Submission form. If it's a Details or Single/Update form, you can use the following code: <script type="text/javascript"> function capitalize() { var fieldname = "YOUR_FIELD_NAME"; fieldname = "EditRecord"+fieldname; confirmname = fieldname+"@Confirm"; document.getElementById(fieldname).value = document.getElementById(fieldname).value.toUpperCase(); document.getElementById(confirmname).value = document.getElementById(confirmname).value.toUpperCase(); } document.getElementById('caspioform').onsubmit=capitalize; </script> Have a nice day! -
Javascript For Capitalizing First Letters In Field
Xiang replied to zzhwvw01's topic in User JavaScript and CSS Discussions
Hello! I have answered in another topic: http://forums.caspio.com/index.php/topic/5600-capitalizing-all-letters/ Have a good day! -
Capitalizing All Letters
Xiang replied to pilotexpressions's topic in User JavaScript and CSS Discussions
Hello Logan, How are you doing? I think, you can use the following script (don't forget to change "YOUR_FIELD_NAME" to the name of your field) <script type="text/javascript"> function capitalize() { var fieldname = "YOUR_FIELD_NAME"; fieldname = "InsertRecord"+fieldname; confirmname = fieldname+"@Confirm"; document.getElementById(fieldname).value = document.getElementById(fieldname).value.toUpperCase(); document.getElementById(confirmname).value = document.getElementById(confirmname).value.toUpperCase(); } document.getElementById('caspioform').onsubmit=capitalize; </script> Fell free to ask, if anything does not work Have a good day! -
codell reacted to an answer to a question: Automatic Redirect Based On The Availability Of Required Parameters
-
Bulk Edit - Javascript To Combine Fields
Xiang replied to georgep's topic in User JavaScript and CSS Discussions
Hi George, How are you doing? I think, the following code can help (you can add a Header&Footer element to your Bulk Update form, select the Footer element, click the Source button and enter the code): <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var ResultFieldName = "Positions"; var position1 = document.getElementById("BulkEditPosition1").value; var position2 = document.getElementById("BulkEditPosition2").value; var allpositions = position1 + position2; var inputName = "BulkEdit"+ ResultFieldName; var checkboxName = "Enable"+ inputName + "Ckb"; document.getElementsByName(checkboxName )[0].checked=true; document.getElementById(inputName).value = allpositions; } var myButtons = document.getElementById("BulkUpdateForm").getElementsByTagName("input"); var textValue = ""; var UpdateButton; for(i=0;i<myButtons.length;i++) { textValue = myButtons[i].getAttribute("type"); if(textValue=="button") { textValue = myButtons[i].getAttribute("value"); if(textValue == "Update") UpdateButton = myButtons[i]; } } UpdateButton.onmouseover=concatenate; </SCRIPT> It works with editable fields, and doesn't work with Hidden fields. Enter the name of your result field instead of "Positions". If you have any problems - feel free to ask, I'll be glad to help. Have a nice day!- 2 replies
-
- bulk edit
- javascript
-
(and 1 more)
Tagged with:
-
Automatic Redirect Based On The Availability Of Required Parameters
Xiang replied to codell's question in Parameters
Hi codell, How are you doing? I think, it's better to create an App Parameter (for example, name it "RedirectURL" and enter the URL of your DataPage as value). Then add a Header&Footer element to your DataPages, select the Header element, click the Source button and enter the code like following: <SCRIPT LANGUAGE="JavaScript"> var ValueParam='[@testParam]'; var redirectURL='[@app:RedirectURL]'; if(ValueParam.length==0) window.location.assign(redirectURL); </SCRIPT> Enter the name of your parameter instead of "testParam" and the name of your App Parameter instead of "RedirectURL". I'll be grateful, if you tell me if the code works or if any errors occur. Have a nice day!- 3 replies
-
- parameters
- required parameters
-
(and 3 more)
Tagged with:
-
aam82 reacted to an answer to a question: Acknowledgement Email Multiple Emails Via Parameters
-
Xiang reacted to an answer to a question: Recording "record Count" Into Data Table?
-
Hi Isabel, How are you doing? I hope, two more links can help: Create a User Registration Process (video) - http://howto.caspio.com/getting-started/create-a-user-registration-process/ Setting Up User Permissions in Your App (article) - http://howto.caspio.com/authentications-and-connections/authentication/setting-up-user-permissions-in-your-app/ Have a nice week-end!
-
Acknowledgement Email Multiple Emails Via Parameters
Xiang replied to flosie0901's question in Parameters
Hi Flosie, How are you doing? I think, you can use the following steps: Add a Virtual field and select a Hidden FormElement for it, then add the Header&Footer element, select the Footer, click the Source button and enter the code: <SCRIPT LANGUAGE="JavaScript"> function emails() { var Regional_Manager = "Regional_Manager"; var Manager = "Manager"; var Submitter = "Submitter"; Regional_Manager = "InsertRecord" + Regional_Manager; Manager = "InsertRecord" + Manager; Submitter = "InsertRecord" + Submitter; var email_Regional_Manager = document.getElementsByName(Regional_Manager)[0].value; var email_Manager = document.getElementsByName(Manager)[0].value; var email_Submitter = document.getElementsByName(Submitter)[0].value; var emailsList = email_Regional_Manager + ";" + email_Manager; if (email_Submitter.length>3) result_email = emailsList + ";" + email_Submitter; document.getElementById("cbParamVirtual1").value = emailsList; } document.getElementById("caspioform").onsubmit=emails; </SCRIPT> And then select your Virtual field as an address for your Acknowledgment email. Please note, if the Virtual Field is not the first, you should change the "cbParamVirtual1" to the correspond number, for example, to "cbParamVirtual3". Could you please let me know, if it works? Have a nice week-end!- 5 replies
-
- acknowledgement_email
-
(and 3 more)
Tagged with:
-
Xiang reacted to a post in a topic: Hide Specific Blank Fields In Emails
-
Hi wvantongeren, How are you doing? I think, you can use the following script: <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_Werkuren = parseFloat(document.getElementById("InsertRecordWerkuren").value); var v_DWM_uren = parseFloat(document.getElementById("InsertRecorddwmuren").value); var v_55_uren = parseFloat(document.getElementById("InsertRecorduren55").value); var v_Ziekte_uren = parseFloat(document.getElementById("InsertRecordziekteuren").value); var v_Scholingsuren = parseFloat(document.getElementById("InsertRecordschooluren").value); var v_Onbetaalde_uren = parseFloat(document.getElementById("InsertRecordonbeturen").value); var v_totaaluren = v_Werkuren + v_DWM_uren + v_55_uren + v_Ziekte_uren + v_Scholingsuren - v_Onbetaalde_uren; document.getElementById("InsertRecordtotaaluren").value = v_totaaluren; } document.getElementById("caspioform").onsubmit=calculate; </SCRIPT> Could you please let me know, if the script works? Have a nice day!
-
Wow! Thank you! I start believing that CSS is a very powerful instrument!
-
Xiang reacted to a question: Id="caspioform" Scroll Height
-
Calculating Difference In Dates
Xiang replied to mmorales's question in Calculations and aggregations
Hi mmorales, Thank you for sharing the solution! Does the query exclude only Sundays?- 3 replies
-
- Business Days
- Date
-
(and 2 more)
Tagged with:
-
Xiang reacted to a question: Calculating Difference In Dates
-
Hello Flosie, I have an idea. I'll try explaining it, but if I'm unclear - ask more details Add a Virtual field (it's should be Virtual1) and select the "Hidden" FormElement. Then for every checkbox, you can add a Virtual field, select the CheckBox FormElement, and enter an email address in the "Value when checked" field. Now you have a Hidden field and all your checkboxes and addresses. Add Header&Footer element, select the Footer, click the Source button, and enter the following code. If only one checkbox is present, you can use this code: <SCRIPT LANGUAGE="JavaScript"> function create_list() { var emailsList = "myfirstEmail@mydomain.com"; if(document.getElementById("cbParamVirtual2").checked) emailsList = emailsList + ";"+document.getElementById("cbParamVirtual2").value; document.getElementById("cbParamVirtual1").value = emailsList; } document.getElementById("caspioform").onsubmit=create_list; </SCRIPT> Please, enter a default address instead of "myfirstEmail@mydomain.com". For waht? If no checkboxes are checked, the DataPage will send an email to nobody, but it is a very bad practice, your Email can be marked as spam, if it sends emails to nobody. If you have two checkboxes, you cope the line if(document.getElementById("cbParamVirtual2").checked) emailsList = emailsList + ";"+document.getElementById("cbParamVirtual2").value; Paste it and change both "2" to "3": if(document.getElementById("cbParamVirtual3").checked) emailsList = emailsList + ";"+document.getElementById("cbParamVirtual3").value; Now the code is: <SCRIPT LANGUAGE="JavaScript"> function create_list() { var emailsList = "myfirstEmail@mydomain.com"; if(document.getElementById("cbParamVirtual2").checked) emailsList = emailsList + ";"+document.getElementById("cbParamVirtual2").value; if(document.getElementById("cbParamVirtual3").checked) emailsList = emailsList + ";"+document.getElementById("cbParamVirtual3").value; document.getElementById("cbParamVirtual1").value = emailsList; } document.getElementById("caspioform").onsubmit=create_list; </SCRIPT> And so on. The last thing - on the " Destination and Emails" screen, check "Acknowledgement email to email address submitted in form" and select Virtual1. Now emails should be send by condition. Please let me know if it works for you
-
Hello Chad, Thank you for sharing this! I like JavaScript code more, but this solution is simple and nice! Please, share more solutions, if you have them
- 2 replies
-
- tip
- conditional format
-
(and 1 more)
Tagged with:
-
Xiang reacted to a question: Conditional Formatting Trick
-
Javascript For Capitalizing First Letters In Field
Xiang replied to zzhwvw01's topic in User JavaScript and CSS Discussions
Hi AR, When a user submits a Form only one "onsubmit" event happens, so only first script works. You can combine both checks in one script: <script type="text/javascript"> function capitalize() { var fieldname = "name_last"; fieldname = "InsertRecord"+fieldname; var value = document.getElementById(fieldname).value; var newVal = ''; val = value.split(' '); for(var c=0; c < val.length; c++) { newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length).toLowerCase() + ' '; } document.getElementById(fieldname).value = newVal; var fieldname2 = "name_first"; fieldname2 = "InsertRecord"+fieldname2; var value2 = document.getElementById(fieldname2).value; var newVal2 = ''; val2 = value2.split(' '); for(var c=0; c < val2.length; c++) { newVal2 += val2[c].substring(0,1).toUpperCase() + val2[c].substring(1,val2[c].length).toLowerCase() + ' '; } document.getElementById(fieldname2).value = newVal2; } document.getElementById('caspioform').onsubmit=capitalize; </script> Does the code work now?