LoginSignup
2
1

More than 5 years have passed since last update.

送信ボタンを押したときにカスタムフィールドに入力された半角英数字を全角英数字に自動変換する【View customizes Plugin】

Last updated at Posted at 2018-10-18

やりたいこと

カスタムフィールドに半角英数字が入力された際に全角英数字に自動的に変換を行いたい。

参考

ある工場のRedmine画面カスタム【View customize plugin 活用例】

動作環境

Redmine3.4.3
View Customize plugin 1.1.4

やり方

Redmineのプラグイン「view customize plugin」を利用します。

下記の設定をview customizeで設定します。

  • Path pattern
/issues
  • Type
JavaScript
  • Code
$(function() {
  $('#issue-form').submit(function() {
    var txt = $('#issue_custom_field_values_1').val();
    var zen = txt.replace(/[A-Za-z0-9]/g, function(s) {
      return String.fromCharCode(s.charCodeAt(0) + 0xFEE0);
    });
    $('#issue_custom_field_values_1').val(zen);
  });
});

【#issue_custom_field_values_1】がカスタムフィールドのidを指定しているので、
ここを変えれば別のカスタムフィールドに適用可能。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1