Eduardo Fuerte
asked on
Could you point how to obtain a variable defined from inside a bootstrap modal screen with a php code running inside ?
Hi Experts
Could you point how to obtain a variable defined from inside a bootstrap modal screen with a php code running inside ?
I have a modal screen with a php grid opened inside it, accordingly to:
The code that generates it:
I know that the grid's selected value, detained by the php code inside the modal screen is:
$selected_keys[0]["SB_CR"]
How to return it to the form that called the modal screen after click OK button?
Thanks in advance.
img_ee_007_070516.png
Could you point how to obtain a variable defined from inside a bootstrap modal screen with a php code running inside ?
I have a modal screen with a php grid opened inside it, accordingly to:
The code that generates it:
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
C
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Escolha o Centro de Responsabilidade</h4>
</div>
<div class="modal-body">
<?php
$KoolControlsFolder = "../KoolPHPSuite/KoolControls";
require $KoolControlsFolder . "/KoolAjax/koolajax.php";
$koolajax->scriptFolder = $KoolControlsFolder . "/KoolAjax";
require $KoolControlsFolder . "/KoolGrid/koolgrid.php";
require $KoolControlsFolder . "/KoolCalendar/koolcalendar.php";
date_default_timezone_set('America/Sao_Paulo');
echo ("<br/>");
$db_con = mysql_connect($db_host,$db_user,$db_word);
$ds = new MySQLDataSource($db_con);
// CR(s) lançáveis
$ds->SelectCommand =
"SELECT SB_CR, DESCRICAO from cr WHERE NIVEL=1";
$grid = new KoolGrid("grid");
$grid->scriptFolder = $KoolControlsFolder . "/KoolGrid";
$grid->styleFolder = "default";
$grid->Localization->Load($KoolControlsFolder."/KoolGrid/localization/vn.xml");
$grid->AllowFiltering = true;
$grid->AjaxEnabled = true;
$grid->DataSource = $ds;
$grid->MasterTable->Pager = new GridPrevNextAndNumericPager();
$grid->ColumnWrap = true;
$grid->AllowEditing = true;
$grid->AllowDeleting = true;
$grid->MasterTable->DataKeyNames = "SB_CR"; // Need to set to get selection
$grid->Width = "500px";
$grid->ShowStatus = false;
$grid->PageSize = 10;
$grid->MasterTable->InsertSettings->ColumnNumber = 1;
$grid->AllowSelecting = true; // Allow row selecting
$column = new GridBoundColumn();
$column->HeaderText = "CR";
$column->DataField = "SB_CR";
$column->Width = "100px";
$grid->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->HeaderText = "Descrição";
$column->DataField = "DESCRICAO";
$column->Width = "400px";
$grid->MasterTable->AddColumn($column);
$grid->Process();
//Get selected keys after grid processing
$selected_keys = $grid->GetInstanceMasterTable()->SelectedKeys;
echo $koolajax->Render();
echo $grid->Render();
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Sair</button>
<button type="button" class="btn btn-primary">OK</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!------------------------------------------------>
I know that the grid's selected value, detained by the php code inside the modal screen is:
$selected_keys[0]["SB_CR"]
How to return it to the form that called the modal screen after click OK button?
Thanks in advance.
img_ee_007_070516.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I used your suggestions and this question derivates to
https://www.experts-exchange.com/questions/28944663/Could-you-explain-how-to-return-a-value-from-a-bootstrap-modal-form-after-it-had-been-obtained.html
If you could have a look....
Thanks
https://www.experts-exchange.com/questions/28944663/Could-you-explain-how-to-return-a-value-from-a-bootstrap-modal-form-after-it-had-been-obtained.html
If you could have a look....
Thanks
I will look at it a little later today
ASKER
Could you give a look on what I adapted accordingly what you posted and maybe suggest what is needed?
Open in new window