⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

edit field callback



tomvsi
  • profile picture
  • Member

Posted 06 November 2012 - 18:18 PM

I have several text fields that all have similar widths.

I currently create a separate callback function for each of them using the following code:


function clock_id_callback($value, $primary_key)
{
return '<input type="text" value="'.$value.'" name="clock_id" maxlength="11" style="width:80px">';
}

The only difference among them is the "name" value. Is there anyway to send the "name" as a third parameter so one function can be utilized rather than several? Example:


function edit_fields_callback($value, $primary_key,$field_name)
{
return '<input type="text" value="'.$value.'" name="'.$field_name.'" maxlength="11" style="width:80px">';
}

It seems like such a waste to duplicate the code.