registerJS(" let foodEmojis = ".json_encode($emoji)."; let index = 0; let lastIndex = ".$randEmojiIndex."; function cycleEmojis() { let newIndex; do { newIndex = Math.floor(Math.random() * foodEmojis.length); } while (newIndex === lastIndex); // Ensure it's different from the last one lastIndex = newIndex; // Update lastIndex to track the last used emoji $('#upload-title').fadeOut(200, function() { $(this).html('Upload Your ' + foodEmojis[newIndex]).fadeIn(200); }); } setInterval(cycleEmojis, 1500); // Change every 1.5 seconds $('#mealform-picture').on('change', function(ev) { $('#submitButton').text('Processing...'); $('#submitButton').attr('disabled', true); $(this).parents('form').submit(); ev.preventDefault(); }); "); ?>
Upload Your
['enctype' => 'multipart/form-data']]); ?>
field($model, 'picture') ->fileInput([ 'class' => 'form-control', 'capture' => 'environment', ]); ?>
'submitButton', 'class' => 'btn btn-success']) ?>