<?php
	$addr = "";
	$dbname = "";
	$vcode = "";

	if (isset($data))
	{
		$bits = explode(':',$data);
		if (count($bits) > 3)
		{
			$addr = $bits[0];
			$dbname = $bits[1];
			$vcode = $bits[2];							
		}
	}
?>
<label style="display: inline;">Address : </label><a id="address" href="#" data-type="text" data-pk="drvname" data-placeholder="Enter IP Address" data-emptytext="Enter DAD Address" data-value="<?php echo $addr; ?>" data-title="Enter DAD Address" class="popupedit"><?php echo $addr; ?></a><br/>
<input id="val_address" name="address" type="hidden" value="<?php echo $addr; ?>"/>

<label style="display: inline;">Database Name : </label><a id="dbname" href="#" data-type="text" data-pk="drvname" data-placeholder="Enter Database Name" data-emptytext="Enter DB Name" data-value="<?php echo $dbname; ?>" data-title="Enter DB Name" class="popupedit"><?php echo $dbname; ?></a><br/>
<input id="val_dbname" name="dbname" type="hidden" value="<?php echo $dbname; ?>"/>

<label style="display: inline;">DAD Version Code: </label><a id="vcode" href="#" data-type="text" data-pk="drvname" data-placeholder="vcode" data-emptytext="Enter Version Code" data-value="<?php echo $vcode; ?>" data-title="Enter Version Code" class="popupedit"><?php echo $vcode; ?></a><br/>
<input id="val_vcode" name="vcode" type="hidden" value="<?php echo $vcode; ?>"/>

<br/><br/>

<input type="submit" value="<?php if (isset($data)) echo "Save Changes"; else echo "Create Source";?>"/><br/>

<script>
function LoadA()
{
		$('#address').editable({
			 url: function(params) {
					var d = new $.Deferred;					
					$('#val_address').val(params.value);						
					return d.resolve();
			  }			
		});
		
		$('#dbname').editable({
			 url: function(params) {
					var d = new $.Deferred;					
					$('#val_dbname').val(params.value);						
					return d.resolve();
			  }			
		});	
		
		$('#vcode').editable({
			 url: function(params) {
					var d = new $.Deferred;					
					$('#val_vcode').val(params.value);						
					return d.resolve();
			  }			
		});				
}
</script>
<!--<select name="type"><option>Discrete Input (Digital In) - 0xxxx</option><option>Coil (Digital Out) - 1xxxx</option><option>Input Register - 2xxxx</option><option>Output Register - 3xxxx</option><option>Register - 4xxxx</option></select>
<input name="address"/>-->