UPDATE: I managed to make it work but the value does not save in the database
function render_field( $field ) {
?>
<label for="total">Total:</label>
<input id="total" type="text" disabled readonly name="<?php echo esc_attr($field['name']) ?>" value='8'>
<script type="text/javascript">
let total = 0;
document.querySelectorAll('input[type="number"]').forEach(el=>total+=+el.value);
document.querySelector('#total').value = total;
console.log(total);
</script>
<?php
}
}
// create field
new acf_field_sum();
Excellent very good indeed Thanks a lot for the help solved my problem.
The “group of fields” is displayed whitout data =(
Sorry, the problem that is happening is that when I put the “markers points” they do not appear on the front-end 🙁
This is the problem, I tried the way you taught me but is the same way …
Now just used meta_value_num worked for numbers up to 999,999.99
For numbers greater than 999,999.99 example:1,000,000.00 does not work the query they play it in the bottom of the screen.
I’m having trouble on the order of some values is to help me again?
'orderby' => 'meta_value_num',
I switched to
'orderby' => 'meta_value meta_value_num',
removed from the register the dollar, let alone the numbers
It worked perfectly! Thank you very much John Huebner. The best support!
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.