I’ve got a text field. The user enters a number, and I use an action to calculate another number and dynamically update a message on the page.
The textField code looks like this:
<?php echo $form->labelEx($model,'points');
echo CHtml::textField('points','00.0',array('id'=>'points-calc',
'ajax' => array(
'type' =>'POST',
'url' => CController::createUrl('Points/convert20to100'),
'update' => '#points100',
'data' => 'html'
)));
In a diagnostic test, I made the convert20to100 action return a message - that works fine.
Once the logic is introduced into the action, requiring the post of the value entered into the ‘points-calc’ textArea to allow the calculation of the update to #points100, I found the post is missing/empty.
I’ve got no idea why.
As a follow up - is there some way to make this work each time you type? At the moment you need to click outside the text area to prompt the update, it really needs to update with each keystroke in the textField.
I’m sure this is simple, but much searching has turned up a blank.
Thanks!