I have some problems with CRED forms. Could you help please.
1. I have a custom select field called 'status' which can be updated in two ways;
First way is using cred_submit_complete function as follows:
add_action('cred_submit_complete_1298', 'change_parent_status', 10, 2); function change_parent_status($post_id){ $sell_list_id = get_post_meta($post_id, '_wpcf_belongs_sell-list_id', true); if (isset($sell_list_id)) { wp_update_post(array('ID' => $sell_list_id, 'post_status' => 'private')); update_post_meta($sell_list_id, 'wpcf-invoice-status', 'notinvoiced'); update_post_meta($sell_list_id, 'wpcf-status', 'New Order'); } }
Second way is using a CRED form as follows;
[credform class="cred-form cred-keep-original"] [cred_field field="form_messages" value=""] [cred_field field="status" post="sell-list" value="" urlparam=""] [cred_field field="form_submit" value="Submit" urlparam=""] [/credform]
When I use the cred_submit_complete method, the field value is updated correctly (means I can see the correct value in a view) but the value is not updated in the back end. This means when I later use the CRED form to allow the user to update the 'status' field, then the wrong value is displayed on the CRED form. Is this a bug? or am I using the wrong CRED API?
2. Discussing the CRED form above. Because it is a select type field, I want to find a way to do update the field value as soon as the user clicks on the required value from the dropdown display. (I mean they don't have to press a submit button as well). Is this possible?
3. I have a problem with all my CRED foms which create new custom posts. If I choose the action 'keep displaying this form' then I get the message 'Post Saved'. I have tried changing this message in the CRED Form Texts but I always get the standard message displayed. Can you explain how to get the Form Texts to work correctly, or alternatively prevent the 'Post Save' message appearing (which I would probably prefer to do).
Sorry for so many questions but I'm trying to get all my CRED issues sorted.
Best regards
Robert