如何在发布到数据库时从字符串中删除特殊字符?

时间:2016-02-22 17:53:12

标签: javascript html angularjs special-characters

我有角色计数器的AngularJs工具提示,我面临两个问题。

1-由于字符串中的特殊字符,当文本区域中的文本复制粘贴时,它不会将其保存到db。

2-它应该只在文本区域中添加4000个字符,而不是应该转义的字符。

我试过下面的代码,如果我添加超过4000个字符超过4000而剩下的字符显示为负数而且也无法保存。

如何解决这些问题?

Ctrl.js

 $scope.$watch('processDTO.processStatementText', function () {
              if (!$scope.processDTO.processStatementText) { 
                $scope.processStatementTextTooltip = '4000'; 
                }
              else { 
                $scope.processStatementTextTooltip = 4000 - $scope.processDTO.processStatementText.replace(/[&<>"'\/]/g,'\r\n').length ;
                }
            });

main.html中

<textarea rows="2" class="form-control"
                ng-model="processDTO.processStatementText"
                name="processStatement" id="processStatement"
                placeholder="Process Statement" maxlength="4000" required
                tooltip="{{processStatementTextTooltip}} characters left"
                tooltip-trigger="{{{true: 'focus', false: 'never'}[processDTO.processStatementText.length >= 0 || processDTO.processStatementText.length == null ]}}"
                tooltip-placement="top" tooltip-class="bluefill">
            </textarea>

TEXT.TXT

2.  Upload Template Header – Risk Causal and Impact comments are color coded as mandatory but they are optional. Similary the Originating Source System Process/Risk/control ID
3.  In the upload template, for any of the multi value fields, I use an invalid delimiter ‘:’, Eg: 13:7 , for some reason this changes the cell format to time format and thereafter I am not able to give any single values, its always converted to time format. Not sure if this is a training issue, but want to put it on the table to see if it requires any fix at all
4.  In Upload, for the grid field length validations, the filter doesn’t works on Row Number and Max Allowed columns.
5.  ERH All levels added in the View End to End ERH screen – Sort and Filter doesn’t works, After clicking on this field, none of the other filter/sort works on the page. Also the sort indicator(black triangle) is not visible, I believe the column width needs to be adjusted.
6.  The Risk/Control reference id is seen on the Process Search grids, but when I search by Risk/Control, I don’t see the corresponding control/risk grid having the ref id column however tool tip has it
7.  The label change “Originating Source System Process/Risk/Control ID” is not done in View/Search Inventory tool tips of Process, Risk, Control grids, It has to be fixed for all the 3 searches “By Process/Risk/Control”
2.  Upload Template Header – Risk Causal and Impact comments are color coded as mandatory but they are optional. Similary the Originating Source System Process/Risk/control ID
3.  In the upload template, for any of the multi value fields, I use an invalid delimiter ‘:’, Eg: 13:7 , for some reason this changes the cell format to time format and thereafter I am not able to give any single values, its always converted to time format. Not sure if this is a training issue, but want to put it on the table to see if it requires any fix at all
4.  In Upload, for the grid field length validations, the filter doesn’t works on Row Number and Max Allowed columns.

0 个答案:

没有答案