Rating field
Star-rating input, typically 1-5 or 1-10 stars. Stored as a number.
The Rating field captures a 1-to-N star rating, typical for satisfaction surveys and reviews. The maximum value is configurable, and half-stars can be enabled for finer granularity.
Binds to SharePoint's Number column.
Common properties
| Property | Description |
|---|---|
labelstring | Visible label. |
descriptionstring | Helper text. |
requiredboolean default: false | Marks the field required. |
readOnlyboolean default: false | Disables editing. |
Type-specific properties
| Property | Description |
|---|---|
maxnumber default: 5 | Number of stars, the top of the scale (e.g. 5 or 10). |
allowHalfboolean default: false | Allow half-stars, so the stored value can be a half-step (e.g. 3.5). |
JavaScript recipes
Read the rating value
const score = f365.field('Satisfaction').value as number | null;
Set the rating programmatically
f365.field('Satisfaction').value = 4;
// with allowHalf enabled:
f365.field('Satisfaction').value = 3.5;
Prompt for feedback on a low score
f365.events.onChange((e) => {
if (e.fieldKey !== 'Satisfaction') return;
const low = Number(e.newValue) > 0 && Number(e.newValue) <= 2;
f365.field('FeedbackComment').required = low;
if (low) f365.ui.showToast('Sorry to hear that, please tell us more.', 'info');
});
Require a rating before save
f365.events.onBeforeSave(() => {
if (!f365.field('Satisfaction').value) {
f365.ui.showToast('Please rate your experience before submitting.', 'error');
return false;
}
return true;
});
Related
Related articles
- Slider field
A numeric input rendered as a draggable slider, good for bounded ranges where exact value matters less than relative position.
- Number field
A numeric input with min/max bounds, step increments, optional thousands separators, and percentage formatting.