I’m stuck with this. Turns out i am using a JUI dialog for the user to input a required password. This is the code of the view which is called by the JUI dialog:
<div class="passwordRequestDialog">
<?php
$form=$this->beginWidget('CActiveForm', array(
'id'=>'requestpassword-form',
'enableAjaxValidation'=>false,
'clientOptions'=>array('validateOnSubmit'=>false),
'htmlOptions'=>array('enctype'=>'multipart/form-data'),
));
?>
<div class="row">
<?php echo CHtml::activeHiddenField($model,'idLiga_hidden',array('value'=>$model->id)); ?>
<?php echo CHtml::label("Ingrese la contrasenia de la liga $model->id?",false, array('style'=>'{font-weight:bold;font-size:12px;}')); ?>
<?php echo CHtml::activePasswordField($model,'password',array('value'=>'')); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton("Guardar"); ?>
</div>
<?php $this->endWidget(); ?>
</div>
However, when i click on the submit button, i can see with firebug the post parameters:
this LigasDeAmigos%5BidLiga_hidden%5D=2&LigasDeAmigos%5Bpassword%5D=typedInPassword
Out of despair, I have tried to get the post parameter in many different ways:
$password = $_POST['this']['password'];
$password = $_POST['this']['LigasDeAmigos']['password'];
$password = $_POST['this']['LigasDeAmigos[password]'];
None of them work… the first one returns always the same value: “L”. I am assuming it is getting the first letter out of the whole “this” parameter. The second one gives an error and so does the third one. Any help is more than welcome!
Edit as suggested by @Jon
print_r($_REQUEST) output
Array
(
[idLiga] => 2
[this] => LigasDeAmigos%5BidLiga_hidden%5D=2&LigasDeAmigos%5Bpassword%5D=pass
)
Any ideas?
Well, I don’t know why the parameters are getting in like this (haven’t done this particular scenario) so I can’t suggest a solution that strikes at the heart of the problem (assuming there is a problem).
However, you can parse the parameters yourself like this:
See it in action.