change dynamically hidden field value based on other field value

change dynamically hidden field value based on other field value

kokotkokot Posts: 7Questions: 0Answers: 0
edited May 2012 in General
Hi there,
i need to change hidden/readonly input value based on the other columns value when editing row in table.
I have this setup :


[code]
$(document).ready(function() {
var editor = new $.fn.dataTable.Editor( {
"ajaxUrl": "php/table.php",
"domTable": "#table",
"fields": [
{
"label": "Hostname",
"name": "hostname",
"type": "readonly"
},
{
"label": "IP",
"name": "ip",
"type": "text"
}
]
} );

var oTable = $('#table').dataTable( {
"sDom": "Tlfrtip",
"iDisplayLength": 25,
"aLengthMenu": [[10, 25, 50, 100, 200, 500, 1000, -1], [10, 25, 50, 100, 200, 500, 1000, "All"]],
"sAjaxSource": "php/table.php",
"aoColumns": [
{
"mDataProp": "hostname",
"sWidth": "20%"
},
{
"mDataProp": "ip",
"sWidth": "20%"
}
]
} );
[/code]

there are 2 fields, "hostname" and "IP". Field hostname is readonly/hidden and i need to set it depending on IP like if IP field is "1.2.3.4" then hostname will be automaticaly submitted as "1.2.3.4.domain.com" .
I am new to JQ..

Replies

  • check_afterhourscheck_afterhours Posts: 2Questions: 0Answers: 0
    Hello,
    Where you able to determine how to change the value on the read-only attribute?

    I'm trying to understand how to setup the value for a hidden attribute(column) based on a session value. i.e the hidden attribute would contain the User's ID, which is contained in the Session context

    "fields": [
    {
    "label": "ID",
    "name": "id",
    "type": "hidden"
    },
    {
    "label": "User name",
    "name": "user_name",
    "type": "text"
    }
    ]
    } );
This discussion has been closed.