This topic is locked

Update multiple fields from List Page

4/17/2016 6:48:41 PM
PHPRunner General questions
mtpocket author

Hi,
I'm trying to update multiple records from List Page & using Ver 8.1
This what my code snippet looks like and the pull down menu looks correct.

$str= "<select id='mycontrol'><option value=''>Select a Reg_No</option>";

global $conn;

$strSQL = "select Reg_No from Daily_Manifest";

$rs = db_query($strSQL,$conn);

while ($data = db_fetch_array($rs))

$str.="<option value='".$data["Reg_No"]."'>". $data["Reg_No"]."</option>";

$str.="</select>";

echo $str;
My Client Before from the List Page is..

if ($("#mycontrol").val()=="") {

alert('Choose something already');

return false;

}

// send the selected value to OnServer event

params['Reg_No']=$("#mycontrol").val();
My Server is...

global $dal;

while ( $data = $button->getNextSelectedRecord() )

{

$sql = "Update Manifest set Reg_No=('".$params['Reg_No']."')

where Waybill=".$data["Waybill"];

CustomQuery($sql);

}
& lastly my Client After is...

location.reload();
After a lengthy search on forum I just couldn't succeed. It just won't populate the "Reg_No" field after multiple select of radio buttons on the left. Even when selecting a single record. Even running the JavaScript troubleshooting didn't help. Too much of a novice.
Any assistance will be appreciated.
Thanks
MT

Sergey Kornilov admin 4/19/2016

In general your approach is correct. You will have to troubleshoot this code or have someone do that.
First step - make sure that value is assigned to params['Reg_No'] in Javascript code. You can set on breakpoint on the following line, step through it and check the value of params['Reg_No']

params['Reg_No']=$("#mycontrol").val();


I think your code that gets the value of dropdown box needs improvement. Check this article:

http://stackoverflow.com/questions/1643227/get-selected-text-from-a-drop-down-list-select-box-using-jquery
If you have a valid support contract feel free to post your project to Demo Account and contact support directly.