It's not "impossible," just ...contrived.
HTML Code:
<input name="area" id="area" value="$10000 Honda Used">
<script>
var area = {};
area.input = document.getElementById( 'area' );
area.input.setAttribute( 'hidden' );
area.value = area.input.value;
area.split_value = area.value.split( ' ',3 );
area.split_value.forEach(
function( v,i,a ){
var splitInput = document.createElement( 'input' );
splitInput.setAttribute( 'name','splitInput_'+i );
splitInput.setAttribute( 'value',v );
document.body.insertBefore( splitInput,area.input );
}
);
</script>
But then, you'd have to keep track of the new inputs and re-combine their values and update the original input. When you submit the form, you'd have to make sure to ditch the "fake" inputs first (because they're not really "fake"). There's a lot more development time, greater possibility of mistakes, and no clear advantage.
I understand your desire to "make it easier for the users." It is entirely appropriate, and splitting the input is the way you should be doing things for many other reasons as well. But doing it in PHP is much more efficient and robust.
Bookmarks