Jump to content

Search the Community

Showing results for tags 'concatenation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Caspio Bridge
    • 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 2 results

  1. I need to combine two (at times more, but once I can resolve for 2 I can easily extend) fields into a third field and commit the value back into the database, all the while working with fields in the results page of a tabular report. The example on the forum, ( http://forums.caspio.com/index.php/topic/3200-js-concatenatecombine-two-fields-into-one-field/ ) , is good but only for submission forms, and the comments on extending it also apply only to update forms or detailed pages of tabular reports. So basically it can't work within a given row in a table as it stands now. I have also checked out the example in ( ) but this one is about totalling a column across multiple rows, and it anyway doesn't commit the results to the database, whereas I need to combine multiple columns across the same row, AND commit to the database. Combining the learnings from the above two examples, I have tried as follows but it is not resulting in any value being inserted in the target field, and my suspicion is I need to do something different in the very last statement of the function. Please advise. 1. Added an HTML block at the top of the list of fields (so effectively the first column in the tabular report) containing: <div id="row_at_a_time"> 2. Added an HTML block at the end of the list of fields (so effectively the last column) containing: </div> <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var ProcessName = document.getElementById("row_at_a_time").getElementByTagName("Table")[1].getElementByTagName("tr")[1].getElementByTagName("td")[1].innerHTML; var ProjectID = document.getElementById("row_at_a_time").getElementByTagName("Table")[1].getElementByTagName("tr")[1].getElementByTagName("td")[6].innerHTML; var ChkUnique = ProjectName + ProjectID; document.getElementById("row_at_a_time").getElementByTagName("Table")[1].getElementByTagName("tr")[1].getElementByTagName("td")[6].innerHTML = ChkUnique; } document.getElementById("caspioform").onsubmit=concatenate; </script> Note that: - The first [1] in each of the statements is something I don't understand but have simply followed the example - what does it refer to? - The second [1] in in the place where the example uses "row_index" so it should help point to "current row" since we have declared each row of the tabular report as a single-row-table (I believe row indexes start at 1, and not 0, unlike column numbers?) - The last number in each of the statements ([1], [6] and [7]) points to the column numbers and means I am setting column [7] to be the concatenation of [1] and [6]. This will have to be customised for each use of this method in various tabular reports. However I think I am missing the equivalent of "insert record" aspect of the following statement and just setting the variable doesn't complete the job: document.getElementById("InsertRecordChkUnique").value = ChkUnique; And therefore this method is not working. Any thoughts? Incidentally I am using this method to enforce uniqueness across multiple columns, so for example column A and column B are individual not unique but column B needs to have unique entries for all records for a given value of column A. I am concatenating the two columns and forcing the value into a third column (hidden from users) which is set to "unique" so that the user is stopped from committing such records. If you know of a different way to achieve this which does not need the above solution, that too will solve my original problem anyway. And the key is to make this work in tabular reports, not just submission or update forms. And it needs to fire on insert as well as update. Many thanks!
  2. I have a multi-select listbox thanks to this article. The only issue is I need these items separated by ";" instead of ",". Here is the code with the changes I have made: <script type="text/javascript"> var v_state = "[@field:Reason_for_Cancelltaion]" ; var o_state = document.getElementById("EditRecordReason_for_Cancelltaion") ; o_state.multiple = true ; function f_listbox() { if ( v_state.indexOf(";") > 0 ) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_state[i].value == v_state) { o_state.remove(i); break ; } } var o_st = v_state.split("; ") ; for (var j=0 ; j < o_st.length; j++) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_st[j]== o_state.options[i].value){ o_state.options[i].selected = true ; break ; } } } } } window.onload = f_listbox ; </script> Even though I have replaced the character it still separates by commas! Otherwise this functions as intended and I have even paired it with some jquery in order to remove the condition of holding down the control key for multiple selections. Any and all help is much appreciated!
×
×
  • Create New...