How to get comma separated decimals to get calculated?
Hi
I have a form with a field called "Areal" where I want to be able to enter comma separated decimals values to be calculated but I have no clue as to where or what to enter in the following piece of code in order to do so ... and at the same time get the result with comma separated values.
I thought it was straight forward and easy to google, but I guess not :-S ... and with no jquery coding experience I am lost.
- <?php
$user =& JFactory::getUser();
if($user->id)
{
echo '<script>jQuery(document).ready(function(){
jQuery("#name").val("'.$user->name.'")
jQuery("#email").val("'.$user->email.'")});</script>';
}
else
{
echo '<script>document.location.href=".../index.php/log-ind"</script>';
}
?>
<?php
$script = "window.addEvent('domready', function() {
$('txtvalue3').addEvent('change', function(event){
name=$('name').get('value');
email=$('email').get('value');
faktura=$('faktura').get('value');
areal=$('areal').get('value');
bygningstype=$('bygningstype').get('value');
value3id=$('txtvalue3').get('value');
value2id=$('value2').get('value');
var strURL = '.../index.php?option=com_chronoforms&view=form&Itemid=121&value2id='+value2id+'&value3id='+value3id+'&faktura='+faktura+'&areal='+areal+'&bygningstype='+bygningstype;
function getXMLHTTP() {
var x = false;
try {
x = new XMLHttpRequest();
}catch(e) {
try {
x = new ActiveXObject('Microsoft.XMLHTTP');
}catch(ex) {
try {
req = new ActiveXObject('Msxml2.XMLHTTP');
}
catch(e1) {
x = false;
}
}
}
return x;
}
var req = getXMLHTTP();
if (req)
{
req.onreadystatechange = function()
{
if (req.readyState == 4)
{
window.location.href= '.../index.php?option=com_chronoforms&view=form&Itemid=121&value2id='+value2id+'&value3id='+value3id+'&faktura='+faktura+'&areal='+areal+'&bygningstype='+bygningstype;
//document.getElementById('kwh').value=req.responseText;
}
}
req.open('GET', strURL, true);
req.send(null);
}
});
});
";
$doc =&JFactory::getDocument();
$doc->addScriptDeclaration( $script );
?>
<script>
jQuery(document).ready(function(){
//jQuery('#username').val('<?php echo $_REQUEST['username']?>');
jQuery('#faktura').val('<?php echo $_REQUEST['faktura']?>');
jQuery('#areal').val('<?php echo $_REQUEST['areal']?>');
jQuery('#value2').val('<?php echo $_REQUEST['value2id']?>');
jQuery('#bygningstype').val('<?php echo $_REQUEST['bygningstype']?>');
jQuery('#txtvalue3').val('<?php echo $_REQUEST['value3id']?>');
});
</script>
<script>
window.addEvent('domready', function() {
$('value2').addEvent('change', function(event){
faktura=$('faktura').get('value');
areal=$('areal').get('value');
bygningstype=$('bygningstype').get('value');
value2id=$('value2').get('value');
value3id=$('txtvalue3').get('value');
var strUserval2 = document.getElementById("areal").value;
var e = document.getElementById("txtvalue3");
var strUser = e.options[e.selectedIndex].value;
if((strUser != null) || (strUserval2 != ""))
{
var strURL = '.../index.php?option=com_chronoforms&view=form&Itemid=121&value2id='+value2id+'&value3id='+value3id+'&faktura='+faktura+'&areal='+areal+'&bygningstype='+bygningstype;
function getXMLHTTP() {
var x = false;
try {
x = new XMLHttpRequest();
}catch(e) {
try {
x = new ActiveXObject('Microsoft.XMLHTTP');
}catch(ex) {
try {
req = new ActiveXObject('Msxml2.XMLHTTP');
}
catch(e1) {
x = false;
}
}
}
return x;
}
var req = getXMLHTTP();
if (req)
{
req.onreadystatechange = function()
{
if (req.readyState == 4)
{
window.location.href= '..../index.php?option=com_chronoforms&view=form&Itemid=121&value2id='+value2id+'&value3id='+value3id+'&faktura='+faktura+'&areal='+areal+'&bygningstype='+bygningstype;
//document.getElementById('kwh').value=req.responseText;
}
}
req.open('GET', strURL, true);
req.send(null);
}
}
});
});
</script>
<script>
window.addEvent('domready', function() {
$('areal').addEvent('blur', function(event){
faktura=$('faktura').get('value');
areal=$('areal').get('value');
bygningstype=$('bygningstype').get('value');
value2id=$('value2').get('value');
value3id=$('txtvalue3').get('value');
var e = document.getElementById("txtvalue3");
var strUser = e.options[e.selectedIndex].value;
if(strUser != null)
{
var strURL = '.../index.php?option=com_chronoforms&view=form&Itemid=121&value2id='+value2id+'&value3id='+value3id+'&faktura='+faktura+'&areal='+areal+'&bygningstype='+bygningstype;
function getXMLHTTP() {
var x = false;
try {
x = new XMLHttpRequest();
}catch(e) {
try {
x = new ActiveXObject('Microsoft.XMLHTTP');
}catch(ex) {
try {
req = new ActiveXObject('Msxml2.XMLHTTP');
}
catch(e1) {
x = false;
}
}
}
return x;
}
var req = getXMLHTTP();
if (req)
{
req.onreadystatechange = function()
{
if (req.readyState == 4)
{
window.location.href= '.../index.php?option=com_chronoforms&view=form&Itemid=121&value2id='+value2id+'&value3id='+value3id+'&faktura='+faktura+'&areal='+areal+'&bygningstype='+bygningstype;
//document.getElementById('kwh').value=req.responseText;
}
}
req.open('GET', strURL, true);
req.send(null);
}
}
});
});
</script>