sisyphus
sisyphus copied to clipboard
Allow persisting fields by ids
I have a form which has some fields with editable default values that other fields inherit from. For example:
<input id="default_subject" />
<input id="subject_1" name="subject_1"/>
<script>
// When our default is updated
$('#default_subject').on('change', function handleUpdate () {
// Update the `subject_1` value
var defaultVal = $('#default_subject').val();
$('#subject_1').val(defaultVal);
});
</script>
These default values are UI only as they are not required by the server. As a result, we don't name them so they don't get sent. However, they are editable by the user and we would like to persist them.
To support this in sisyphus, I would like to add id
to part of the identifier as we do with form. I have created a fork which achieves this but it is short-sighted as we should really allow for a user to define whatever method they want for identifying a field element:
https://github.com/simsalabim/sisyphus/compare/3d9dd246a4d95fa6f12646a33944c1c370bb1099
There were a few restore kinks in that posted link, this should work better:
https://github.com/simsalabim/sisyphus/compare/c7e9c9e
@twolfson that's an interesting use case that I've never thought about. Could you please wrap it up as a PR so I could review and test it?
Sure thing, one PR coming up.