# Editing Data

Make changes to your database records directly within Simpl.

## Overview

Simpl allows inline editing of record values, with type-appropriate input controls for each field type. Changes are saved directly to your database.

## Enabling Edit Mode

### Clicking to Edit

In the detail view, click any editable field to enter edit mode. The field transforms into an appropriate input control.

### Edit Indicators

Editable fields show a subtle hover effect indicating they can be modified.

## Type-Specific Editors

### Text Fields
- Single-line text input for short strings
- Multi-line textarea for longer content
- Auto-expanding based on content length

### Number Fields
- Numeric input with appropriate precision
- Increment/decrement controls
- Validation for numeric values only

### Boolean Fields
- Toggle switch for easy true/false selection
- Clear visual state indication

### Date and DateTime Fields
- Calendar date picker
- Time picker for datetime fields
- Clear button to set null

### Enum Fields
- Dropdown with all valid enum values
- Quick selection from predefined options

### JSON Fields
- Syntax-highlighted JSON editor
- Auto-formatting on blur
- Validation for valid JSON

### Array Fields
- Add/remove array items
- Reorder items via drag-and-drop
- Type-appropriate inputs for array elements

### UUID Fields
- Text input with UUID validation
- Generate new UUID button

## Saving Changes

### Confirm and Cancel

After making changes, you'll see action buttons:

| Button | Action |
| --- | --- |
| ✓ (Checkmark) | Save changes to database |
| ✕ (X) | Cancel and discard changes |

### Keyboard Shortcuts

| Key | Action |
| --- | --- |
| `Enter` | Save changes (single-line fields) |
| `Escape` | Cancel editing |
| `Cmd/Ctrl + Enter` | Save changes (multi-line fields) |

### Success Feedback

After saving, you'll see a toast notification confirming the change.

### Error Handling

If a save fails, you'll see an error message explaining what went wrong:
- Database constraint violations
- Type validation errors
- Connection issues

## What Can Be Edited

### Editable Fields

Most standard column types are editable:
- Text (varchar, text, char)
- Numbers (integer, decimal, float)
- Booleans
- Dates and timestamps
- Enums
- JSON
- Arrays
- UUIDs

### Non-Editable Fields

Some fields cannot be edited:
- **Primary keys** - Usually auto-generated and immutable
- **Serial/auto-increment columns** - Managed by the database
- **Computed columns** - Generated by database expressions
- **System columns** - Internal PostgreSQL fields

## Database Constraints

### Validation

Simpl respects your database constraints:
- **NOT NULL** - Required fields must have values
- **UNIQUE** - Duplicate values are rejected
- **CHECK constraints** - Invalid values show errors
- **Foreign keys** - References must exist

### Constraint Errors

When a constraint is violated, you'll see:
1. The save fails
2. An error message appears
3. The field remains in edit mode
4. You can fix the value or cancel

## Best Practices

### Verify Before Saving

Always double-check values before confirming:
- Review the change you're making
- Consider downstream effects
- Check related records if relevant

### Use Detail View

For complex edits, use the detail view rather than list view for:
- Better context around the record
- Easier navigation between fields
- Clearer view of related data

### Test in Development First

When making significant changes:
- Test on a development/staging database first
- Verify the changes work as expected
- Then apply to production

## Audit Considerations

### No Built-in Audit Trail

Simpl doesn't maintain its own audit log of changes. Consider:
- Database-level audit triggers
- Application logging
- PostgreSQL's built-in audit extensions

### Who Made Changes

Changes are made using your connection's credentials. The database sees the connection user, not your Simpl user.

## Bulk Editing

Currently, Simpl supports editing one field at a time. For bulk operations:
- Use SQL directly
- Consider database migration tools
- Build application-level batch operations

## Current Limitations
- **One field at a time** - Edit and save each field individually
- **No undo** - Changes are immediate; no built-in rollback
- **Connection permissions** - Your database user must have UPDATE privileges

## Next Steps
- [Navigate relationships](/content/docs/features/relationships/index.html) to explore connected data
- [Use keyboard shortcuts](/content/docs/features/keyboard-shortcuts/index.html) for faster workflow
- [Export your data](/content/docs/features/export/index.html) for backup or analysis
