does anyone know how to setup input fields from server-side data?

does anyone know how to setup input fields from server-side data?

toytoy Posts: 2Questions: 0Answers: 0
edited April 2011 in General
hey all
noob here so sorry if this has already beeen answered

so if i call data with the sAjaxSource param
and one of the cols is a bool (set to TRUE)
i want it to appear in my table as a checked checkbox

can someone point me to the doc for this?
thanks!

Replies

  • AlawrenceAlawrence Posts: 18Questions: 0Answers: 0
    One way would simply be to set that column on your output to create the checkbox with an input statement. So from your Ajaxsource just modify the output so that it outputs the input statement with the column data as the value of the checkbox. Then on your HTML side just add some java that looks at the checkbox and sets it checked or unchecked based on the value.
  • toytoy Posts: 2Questions: 0Answers: 0
    thanks alawrence
    ive gone ahead with your suggestion
    but now im running into a quoting issue

    so right now ive got this:

    $a = array();
    foreach($messages as $m){
    $cb = addslashes(activeBox($m["active"], true, $m["messageID"], false));
    $b = array($m["messageID"], stripslashes($m["message"]), stripslashes($m["messageType"]), $cb);
    $a[] = $b;
    }

    // setup output array
    $goo = array(
    "sEcho"=> "nboaseibl asdl a",
    "iTotalRecords"=>count($messages),
    "iTotalDisplayRecords"=>100,
    "aaData"=>$a
    );

    where activeBox returns this:


    and $goo looks like this:

    [sEcho] => nboaseibl asdl a
    [iTotalRecords] => 1
    [iTotalDisplayRecords] => 100
    [aaData] => Array
    (
    [0] => Array
    (
    [0] => 3
    [1] => Outage note
    [2] => outage
    [3] =>
    )
    )


    if you notice - ive added the 'addslashes' command to $cb
    becuase if i dont i get the bad json data error
    but with the addslashes i STILL get the bad json data error

    what is the correct format i should be putting the checkbox info in?
  • AlawrenceAlawrence Posts: 18Questions: 0Answers: 0
    First I would try running Firebug and from the console watch to see exactly what is happening during the the data request. Is it possible for you to post both the HTML side and the Data side code as I am having trouble following the code above completely.
This discussion has been closed.