0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

lightning-input-field がチェックボックスフィールドに対して機能しない

0
Posted at

Actually this is not correct. Using the value attribute for a Checkbox results in a java script error b/c can't convert from String to Boolean. Spoke with SF support and there is a problem with the lightning-input-field in that there is no way to override the field's Boolean/checkbox value (i.e. no way to set to checked if the Boolean value is false). Can't believe this hasn't been reported before.....

Workaround is to manually set the field value using JS on form submit via setFormFieldValue (example: this.setFormFieldValue('Reserved_Timeslot__c', true); will set the Object's Reserved_Timeslot__c to true even though it is false in the DB.)

実はこれは正しくありません。チェックボックスに value 属性を使用すると、文字列からブール値に変換できないため、Java スクリプト エラーが発生します。SF サポートに問い合わせたところ、フィールドのブール値/チェックボックス値をオーバーライドする方法がない (つまり、ブール値が false の場合にチェック済みに設定する方法がない) という点で、lightning-input-field に問題があります。これまで報道されていなかったことが信じられない……。

回避策は、setFormFieldValue 経由でフォーム送信時に JS を使用してフィールド値を手動で設定することです (例: this.setFormFieldValue('Reserved_Timeslot__c', true); これにより、DB では false であっても、オブジェクトの Reserved_Timeslot__c が true に設定されます)。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?