Forum


Hallo,
i use dataUrl to get the html for the select field from the DB.
{name:'projektname', index:'projektname', width:160,
editable: true,
edittype:"select",
editoptions:{dataUrl:'/backlink/get-projektname'} //, defaultValue:'Intime'}
//formoptions:{ rowpos:3,elmprefix:" " }
},
now i have a second select field. This should get the html for the field from DB in dependence from the first one.
editable: true,
edittype:"select",
editoptions:{dataUrl:'/backlink/get-unterprojektname?selectfieldone=value'} //, defaultValue:'Intime'}
},
How can I get the value of the first select field to the dataUrl of the second select field? Or is there another way?
Thanks.
Ok it works.
I only have one probleme.
If i edit a row in the form it shows me the right value of the first select field but the wrong value of the second depended select field.
In the second select field it use the first <option> entry.
If i use the buttons next i get the next row and the right value for the second select field.
colModel :[
{name:'projektname', index:'projektname', width:160, sorttype:"string", edittype:"select", editoptions:{"value":selectfeldProjektname['responseText'],"separator":":"}, editable:true },
{name:'unterprojektname', index:'unterprojektname', width:160, sorttype:"string",edittype:"select",editoptions:{"value":" :select"},editable:true},
….
"beforeShowForm":function(formid)
{
// get the value of the country
var cntryval = $("#projektname",formid).val();
jQuery("#unterprojektname",formid).html("<option>Select</option>");
if(cntryval) {
// if the value is found try to use ajax call to obtain the citys
// please look at file file city.php
jQuery.ajax({
url: '/backlink/get-unterprojektname',
dataType: 'html',
//async: false,
data: {q:cntryval},
success : function(response)
{
sv="";
var sr = jQuery("#list").jqGrid('getGridParam','selrow');
console.log (sr);
if(sr)
{
// get the selected city from grid
sv = jQuery("#list").jqGrid('getCell',sr,'unterprojektname');
// empty the select and put the new selection
jQuery("#unterprojektname",formid).html("").append(response);
if(sv)
{
console.log (sv);
// select the city value
jQuery("#unterprojektname",formid).val(sv).removeAttr("disabled");
}
}
}
});
} else {
jQuery("#unterprojektname",formid).attr("disabled","disabled");
}
},
console.log (sr) = 4
console.log (sv) = oekostrom
request from url: '/backlink/get-unterprojektname' = <option value='stromrechner-vergleich'>stromrechner-vergleich</option>
<option value='oekostrom'>oekostrom</option>….
Html from second select field:
<select role="select" id="unterprojektname" name="unterprojektname" size="1″ class="FormElement">
<option value="stromrechner-vergleich">stromrechner-vergleich</option>
<option value="oekostrom">oekostrom</option>
….
</select>
What can be wrong??
Most Users Ever Online: 715
Currently Online:
46 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66