Jump to content

JS: Concatenate/Combine two fields into one field

Recommended Posts

JavaScript Solution: Concatenate/Combine two fields into one field

Feature Description:
This JavaScript solution shows how to perform a function in a Submission Form to combine two fields' values and put them into another field. Values entered in two fields "Position1" and"Position2" are concatenated and the result is stored in the field "AllPositions" upon submission.

This solution can be used "as-is", without any changes if
a. It is used in a Submission Form DataPage and
b. The fields Position1, Position2, and AllPositions exist in your table and the form.
c. The form is the only one Caspio DataPage deployed on your web page.

To use this solution copy and paste the code below, inside the HTML Footer section of the Submission Form using the Caspio Bridge DataPage Wizard.





function concatenate()
var position1 = document.getElementById("InsertRecordPosition1").value;
var position2 = document.getElementById("InsertRecordPosition2").value;

var allpositions = position1 + position2;

document.getElementById("InsertRecordAllPositions").value = allpositions;



Tips for Customization
To customize this script to be used on an Update Form or a Details page of a Search and Report DataPage, replace the prefix "InsertRecord" with "EditRecord" in the code.

Tested Browsers
This JavaScript solution was tested on the following platforms and Internet Browsers only.
# MS Windows - IE 8.0, Firefox 3.6.3, Chrome 4.1.249, Safari 4.0.3
# Macintosh - Firefox 3.5.7, Safari 4.0.3

Disclaimer: Use these JavaScript solutions at your own risk! They are provided to assist you in the customization of your programs and while we believe they work properly, by using them you accept all responsibility about them and confirm that they are not a feature of Caspio's platforms and as such are provided "as is" without any warranties, support or guarantees.

Link to post
Share on other sites
This topic is now closed to further replies.
  • Create New...