Hi, watch this link
https://support.advancedcustomfields.com/forums/topic/can-you-update-a-row-in-a-repeater/
maybe it helps
Regards!
Hi,
after a long time, I found what I think be a solution
in core/validation.php line 158 change:
if( !acf_verify_ajax() ) die();
to
if( acf_verify_ajax() ) die();
this solve my question, but updates concern me
Hello, try removing any version of jQuery and make sure the error persists.
I’m also no expert, just a technical curious, and greatly appreciate your attention to this cause.
One of the tests I have done was just go through the field of interest (by class, by id by name) yet, even giving ‘print’ in the log panel, the values are not saved and not shown in the relevant field.
What amazes me most is the fact that the field values post-object and user ‘saved’ about to be removed from the list of options, but not to the point of being obtained with get.
Interestingly, get these fields, only work when I do the exclusion of these fields in my group.
The more I move, the farther I seem to be a solution to all fields.
Again, thank you for your suggestions.
John Huebner, Thanks for your suggestion, but I tested a few things in this direction and also can not get the desired result. Any suggestions for how should select any element of the form?
Maybe it’s really the problem, but doing some ‘table tests’, get in console.log the values that are assigned or selected in the form fields.
See…
https://www.youtube.com/watch?v=XO_Fm_dSwrQ&feature=youtu.be
Already I disabled all the hooks and additional plugins, but nothing changes.
Any other suggestions?
Hello, you can try something like:
<?php
$model_name = get_field('model_name');
switch ($model_name) {
case 'iphone':
/* if no page output / print / echo to this function */
$redirect = "http://www.yourlinkredirect.com";
header("location:$redirect");
break;
case 'samsung':
/* with javascript help */
echo '<script language="JavaScript">
window.location="http://www.yourlinkredirect.com";
</script> '
break;
case 'others':
/* ... */
break;
}
?>
I hope that helps, hug…
Oh dear, I’m a dumb!
My problem was that the reference ID was wrong, so would never work. But not to be so ugly, I share my finding.
The code to create a form based on another is:
Front End
<?php
$customtype = get_field('page_customtype');
$idform = get_field('page_idform');
$args = array(
'post_id' => 'newpost_'.$customtype ,
'field_groups' => array( $idform ),
'return' => add_query_arg( 'updated', 'true', "#" ),
);
acf_form( $args );
?>
And the part that makes me proud is how to treat the data to insert without having to have the reference (KeyField) of each field:
functions.php
function my_pre_save_post( $post_id ) {
$customtype = explode('_' , $post_id );
$post = array(
'post_status' => 'Publish',
'post_type' => $customtype[1],
);
$post_id = wp_insert_post( $post );
while (list($key, $value) = each($_POST['acf'])) {
$var = $var . "Key: $key; Value: $value<br />\n";
$namefield = get_field_object($key);
add_post_meta ($post_id, $namefield['name'] , $value, true);
}
}
add_filter('acf/pre_save_post' , 'my_pre_save_post', 10, 1 );
Thus a job that took hours (depending on the number of forms) only takes a few minutes.
I hope I can help in any way
Hi RobinL,
You are making use of this form on the front end?
If so, you must remember to use the ID with
'user_'.$user_id
I hope this helps
Hi mrdirby,
have you tried using the ‘relational’ query to set this?
$meta_query_args = array(
'relation' => 'OR', // Optional, defaults to "AND"
array(
'key' => '_my_custom_key',
'value' => 'Value I am looking for',
'compare' => '='
)
);
$meta_query = new WP_Meta_Query( $meta_query_args );
I hope to have helped
Hello jobo21 to upload on front-end rule that works is admin or editor so you can check the permissions of these users and enable only rule you need.
Hi ch1n3s3b0y
In its front page you should put something like:
<?php
acf_form(array(
'post_id' => 'new_post_emp',
'field_groups' => array( 86 ),
'return' => add_query_arg( 'updated', 'true', "http://qgbrain.com.br/web/assesstment/pesquisar-empresa/" ),
));
?>
In the function.php you should put:
<?php
add_filter('acf/pre_save_post' , 'my_pre_save_post' );
function my_pre_save_post( $post_id ) {
if( $post_id == 'new_post_emp' ) {
// data send by POST in form
$title = $_POST['fields']['field_552b299a1844c'];
// Default data post
$post = array(
'post_status' => 'Publish',
'post_type' => 'processos',
'post_title' => '0000 |'.$title,
);
// action for update
$post_id = wp_insert_post( $post );
}
}
?>
this way the created form is available on your front-end
I hope it helped
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.