EasyUI Forum
April 23, 2024, 06:21:50 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: as passing a data value selected from a combo  (Read 7368 times)
DanielJ
Newbie
*
Posts: 2


View Profile Email
« on: July 26, 2013, 11:46:38 AM »

I have a combo, I want to pass the id to the grid, I find the way to do

my code PHP/HTML:

Code:
<?php 
  
include 'conn.php';
 
$consulta="SELECT cve_prov, nombre_prov FROM tproveedores"
 
$resultmysql_query ($consulta)
?>

  <select name="cboProv" id="cboProveedor" class="easyui-combobox" required="true">
    <option value="">Seleccione...</option>
     <?php
         
while ($filamysql_fetch_array($result)){
               echo 
"<option value='".$fila['0']."'>".$fila['1']."</option>";
       echo $fila['0'];
              } 
    
?>


Code Javascript
Code:
   function agregar(){
          // declare variables to bring me the form data
   var nombre=$("#nombre_art").val();  //this value has a good time
      var precio=$("#precio_art").val();    //this value has a good time
   var cboProv=$("#cboProveedor").val();  //this value does not pass

      var row = $('#dg').datagrid('getSelected');
if (row){
var index = $('#dg').datagrid('getRowIndex', row);
} else {
index = 0;
}
$('#dg').datagrid('insertRow', {
index: index,
row:{
   nombre_art_prov: nombre,
   precio_art_prov: precio,
   fk_cve_proveedor: cboProv
}
});
$('#dg').datagrid('selectRow',index);
$('#dg').datagrid('beginEdit',index);
}
image of the grid

excuse my English writing, I try to let me know .. thank you

Daniel
« Last Edit: July 26, 2013, 11:51:07 AM by DanielJ » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 26, 2013, 08:20:44 PM »

Notice that '#cboProveedor' is a combobox object, you need to call 'getValue' method to get its value.
Code:
var cboProv=$("#cboProveedor").combobox('getValue');
Logged
DanielJ
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: August 05, 2013, 09:34:14 AM »

Notice that '#cboProveedor' is a combobox object, you need to call 'getValue' method to get its value.
Code:
var cboProv=$("#cboProveedor").combobox('getValue');

Thank you, I appreciate your attention
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!