Tell us what you are trying to do?
I have a required field that contributors must enter in a value, before being able to submit the form. This information is only so I know as an administrator what they've changed.
Once Ive actioned the submission in the back end, this information is no longer needed. At the moment the information is stored within the database, which means unless I clear it manually, its going to carry that value over so when the next contributor wants to make a change, they'll see the information entered into this field by the previous contributor. its not a big deal, but having to remember to clear it every time I action a submission in the back end is going to eventually become a nuisance.
How can I either reset the value to null when the form itself loads, or clear it upon submission of the form?
Is there any documentation that you are following?
I did find these two threads, but Im not sure if this is what I need?
https://toolset.com/forums/topic/overwrite-value-with-preset-generic-field-value/
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
Is there a similar example that we can see?
Sure. Code for the CRED form below.
[credform class='cred-form cred-keep-original']
[cred_field field='form_messages' value='' class='alert alert-warning']
<div class="form-group">
<label>Vehicle Description</label>
[cred_field field='post_content' post='vehicle' value='' urlparam='' output='bootstrap']
</div>
Vehicle Specifications
<div class="row">
<div class="col-sm-6"><label>Make</label>
[cred_field field='make' post='vehicle' value='' urlparam='' class='form-control' output='bootstrap']</div>
<div class="col-sm-6"><label>Model</label>
[cred_field field='model' post='vehicle' value='' urlparam='' class='form-control' output='bootstrap']</div>
</div>
<div class="hidden">
[cred_field field='revision-author' post='vehicle' value='[wpv-current-user]' urlparam='']
[cred_field field='revision-email' post='vehicle' value='[wpv-current-user info="email"]' urlparam='']
</div>
<br><br>
<div class="form-group">
<label>Edit Summary (Briefly describe your changes)</label>
[cred_field field='revision-summary' post='vehicle' value='' urlparam='' class='form-control' output='bootstrap']
</div>
<div class="form-group">
[cred_generic_field field='agree' type='checkbox' class='' urlparam='']
{
"required":1,
"validate_format":0,
"checked":0,
"default":"1",
"label":"By submitting this change you agree to our terms of use"
}
[/cred_generic_field]
[cred_show_group if="($(agree) eq '1' )" mode='fade-slide']
PLEASE NOTE - All changes are reviewed by a moderator before being posted live, which is usually done within 24 hours if not sooner. Thank you for contributing.
[/cred_show_group]
</div>
[cred_field field='form_submit' value='Submit for Review' urlparam='' class='btn btn-primary btn-lg' output='bootstrap']
[/credform]
Its this field here that I want to clear each time the form loads for contributors.
[cred_field field='revision-summary' post='vehicle' value='' urlparam='' class='form-control' output='bootstrap']
What is the link to your site?
Im working on localhost
Thanks guys, incredible piece of software you've put together.