LoginSignup
0
2

More than 5 years have passed since last update.

送信ボタンを押したときにカスタムフィールドに入力されている特定の文字を別の特定の文字に変換する方法【View customizes Plugin】

Last updated at Posted at 2018-10-19

やりたいこと

チケット起票または更新時に特定のカスタムフィールドに入力されている
カタカナの「ニ」を漢数字の「二」に変換したい。
(なんてニッチな要望なんだ!)

参考

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

使用するプラグイン

View Customize plugin
https://github.com/onozaty/redmine-view-customize

やり方

  • Path pattern
/issues
  • Type
JavaScript
  • Code
//submmit時、所属に入力されたカタカナの「ニ」を漢数字の「二」に自動変換する
$(function() {
  $('#issue-form').submit(function() {
    var txt = $('#issue_custom_field_values_1').val();
    var kan = txt.replace('ニ', '二');
    $('#issue_custom_field_values_1').val(kan);
  });
});

【#issue_custom_field_values_1】がカスタムフィールドのidを指定しているので、
ここを変えれば別のカスタムフィールドに適用可能。
【txt.replace】の()内を変えてあげれば他の文字にも対応。

0
2
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
0
2