フォームの値を取得して計算するClient Scriptの書き方について
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
01-10-2024 07:16 AM - 編集済み 01-10-2024 08:09 AM
表題について、フォーム上のIntegerのタイプのフィールドから値を取得して計算し、
別のIntegerタイプのフィールドに値を設定するClient Scriptを書こうとしています。
私がJavascript初心者であることもあり、うまく動作せずに困っています。
ご協力いただけないでしょうか。
具体的には、フォーム上からIntegerの数値を取得し、消費税を計算させてIntegerのフィールドに格納したいです。
テーブル:Forecast
Type:onChange
フィールド:Planned Amount(Excludint Tax)
入力したいフィールド:Consumption Tax(消費税)
***以下Script***

- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
01-14-2024 02:35 PM
@Toshikazu If you want to keep decimal value then you can not store into integer type field, This is the functionality of integer type field, it will not allow you to store decimal value.
If you can not change the field type, create new field and migrate old data from your integer type field to new field and then going forward maintain the calculation in new field.
Thanks,
Harsh

- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
10-17-2024 10:19 PM
少し古いスレッドですが解決されていないために返信します。
消費税の端数は「切り捨て」「切り上げ」「四捨五入」のどれかにします。
次の例では切り捨てにします。JavaScriptのfloorメソッドを使い整数に変換します。