FormIt icon indicating copy to clipboard operation
FormIt copied to clipboard

Patch multi dimensional array fields

Open goldsky opened this issue 13 years ago • 4 comments

with optional to use dynamicFieldTpls property for dynamic HTML form added by javascript. Fallback to implode them with commas to be used by the original Formit's checkboxes snippet.

goldsky avatar Jun 09 '12 09:06 goldsky


<script>
    var newMob = '[[$mobilephoneDynamicFormChunk:customOutputFilters=`chunkToJsProperty`]]' + "\n";
</script>

chunkToJsProperty:

<?php

$expOptions = @explode(',', $options);
array_walk($expOptions, create_function('&$val', '$val = trim($val);'));

$output = $input;
if (in_array('chunkToJsProperty', $expOptions)) {
    $output = str_replace('/', '\/', $output);
    $output = str_replace("\n", '', $output);
    $output = preg_replace("/(>+(\s)*<+)/", '><', $output);
    $output = preg_replace("/\s+/", ' ', $output);
}

return $output;

goldsky avatar Jun 09 '12 09:06 goldsky

I'm having a hard time understanding the use case for this one

jpdevries avatar Feb 05 '14 09:02 jpdevries

I'll make a demo

goldsky avatar Feb 05 '14 10:02 goldsky

Can this answer your question? http://revo.virtudraft.com/formit-and-dynamic-fields

Actually, I also submitted the pull request on Login.Profile for the same reason. https://github.com/goldsky/Login/commits/develop-extended

goldsky avatar Feb 05 '14 12:02 goldsky