Math Functions


Registered User
12 posts

Can I just ask one more question? Beneath I have a text line, can I enter the total value inside that text box after my two words: "Volledig bedrag: € ..." ?

Yours sincerly,

Luc
I tried
var text1 = "Inschrijven .... bedrag € "
var text2 = text1 + total + " over te ...."
jQ("input[name='AllText']").val(text2);


Senior Advisor
17,334 posts
Online Now

Sure ;)
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
var jQ = $.noConflict(true);
jQ(document).ready(function(){

jQ("input[name='text77'], input[name='text78']").keyup(function(){
var valone = jQ("input[name='text77']").val();
var valtwo = 10;
if(jQ.isNumeric(valone)){
var totalv = (valone * valtwo);
jQ("input[name='text74']").val(totalv.toFixed(2));
}

var valeen = jQ("input[name='text78']").val();
var valtwee = 7;
if(jQ.isNumeric(valeen)){
var totalk = (valeen * valtwee);
jQ("input[name='text75']").val(totalk.toFixed(2));

}
totalv = totalv || 0 ;
totalk = totalk || 0 ;
var Total = parseInt(totalv) + parseInt(totalk) ;
jQ("input[name='total']").val('');
jQ("input[name='total']").val("Inschrijven .... bedrag € " + Total.toFixed(2));
});
});
</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Registered User
12 posts

Hi, thanks for helping. It works if I put the result in a text field, but the text is written in 1 line.
I'd like to have it in a textarea, so I can adjust height. Just like bold text on example.

How to put text in bold?

Yours sincerly,

Luc


Registered User
12 posts

I already found how to put text in textarea. But how to adjust textcolor, background color, etc. ...

Thanks
Luc


Senior Advisor
17,334 posts
Online Now

Can you share what you have on your form so far with the text area so I know were looking at the same thing? Is there anything else you need done with the calculations? I would rather have all the info so I don't have to redo somthing I've already done.:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Registered User
12 posts

Yeah sure,
http://hbcactiviteit.coffeecup.com/forms/spaghetti/

this is what I have:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
var jQ = $.noConflict(true);
jQ(document).ready(function(){

jQ("input[name='text77'], input[name='text78']").keyup(function(){
var valone = jQ("input[name='text77']").val();
var valtwo = 10;
if(jQ.isNumeric(valone)){
var totalv = (valone * valtwo);
jQ("input[name='text74']").val(totalv.toFixed(2));
}

var valeen = jQ("input[name='text78']").val();
var valtwee = 7;
if(jQ.isNumeric(valeen)){
var totalk = (valeen * valtwee);
jQ("input[name='text75']").val(totalk.toFixed(2));

}
totalv = totalv || 0
totalk = totalk || 0
var Total = parseInt(totalv) + parseInt(totalk) ;
jQ("textarea[name='total']").val('');
jQ("textarea[name='total']").val("Inschrijven kan je doen .... bedrag, zijnde € " + Total.toFixed(2) + "over te ...."):
});
});
</script>

So, I changed the text in black just above, "Select an option", so that the amount is visible.But I want to change the text color, put in bold, .. Is it possible to add a CSS to this? I know how to make / write CSS but not to handle with javascript.

Yours sincerly,

Luc


Senior Advisor
17,334 posts
Online Now

Add this to the head of the page to target the fonts in the text area
<style>
#docContainer textarea[name="textopm"] {
color:red;
font-weight:bold;
}
</style>

JS
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
//ver 2.0
var jQ = $.noConflict(true);
jQ(document).ready(function(){

jQ("input[name='text77'], input[name='text78']").keyup(function(){
var valone = jQ("input[name='text77']").val();
var valtwo = 10;
if(jQ.isNumeric(valone)){
var totalv = (valone * valtwo);
jQ("input[name='text74']").val(totalv.toFixed(2));
}

var valeen = jQ("input[name='text78']").val();
var valtwee = 7;
if(jQ.isNumeric(valeen)){
var totalk = (valeen * valtwee);
jQ("input[name='text75']").val(totalk.toFixed(2));

}
totalv = totalv || 0;
totalk = totalk || 0;
var Total = parseInt(totalv) + parseInt(totalk) ;
jQ("textarea[name='textopm']").val('');
jQ("textarea[name='textopm']").val("Inschrijven kan je doen .... bedrag, zijnde € " + Total.toFixed(2) + "over te ....");
});
});
</script>


If you want to change th font styling with js then use this.
<script type="text/javascript">
//ver 2.0
var jQ = $.noConflict(true);
jQ(document).ready(function(){
jQ("textarea[name='textopm']").css({
'font-weight' : 'bold',
'font-size' : '16px',
'color' : 'red'
});

jQ("input[name='text77'], input[name='text78']").keyup(function(){
var valone = jQ("input[name='text77']").val();
var valtwo = 10;
if(jQ.isNumeric(valone)){
var totalv = (valone * valtwo);
jQ("input[name='text74']").val(totalv.toFixed(2));
}

var valeen = jQ("input[name='text78']").val();
var valtwee = 7;
if(jQ.isNumeric(valeen)){
var totalk = (valeen * valtwee);
jQ("input[name='text75']").val(totalk.toFixed(2));

}
totalv = totalv || 0;
totalk = totalk || 0;
var Total = parseInt(totalv) + parseInt(totalk) ;
jQ("textarea[name='textopm']").val('');
jQ("textarea[name='textopm']").val("Inschrijven kan je doen .... bedrag, zijnde € " + Total.toFixed(2) + "over te ....");
});
});
</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Registered User
12 posts

Thanks !!!
Just an last question, How can I also add the name entered in Naam field, put inside that textopm field.
I did following:
Var MyName = jQ("input[name='text3']".val()


Under totalv = totalv ?? 0
I put MyName = MyName ?? ''

But stays empty


Senior Advisor
17,334 posts
Online Now

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
//ver 2.0
var jQ = $.noConflict(true);
jQ(document).ready(function(){
jQ("textarea[name='textopm']").css({
'font-weight' : 'bold',
'font-size' : '16px',
'color' : 'red'
});

jQ("input[name='text77'], input[name='text78']").keyup(function(){
var valone = jQ("input[name='text77']").val();
var valtwo = 10;
if(jQ.isNumeric(valone)){
var totalv = (valone * valtwo);
jQ("input[name='text74']").val(totalv.toFixed(2));
}

var valeen = jQ("input[name='text78']").val();
var valtwee = 7;
if(jQ.isNumeric(valeen)){
var totalk = (valeen * valtwee);
jQ("input[name='text75']").val(totalk.toFixed(2));

}
var MyName = jQ("input[name='text3']").val();
totalv = totalv || 0;
totalk = totalk || 0;
var Total = parseInt(totalv) + parseInt(totalk) ;
jQ("textarea[name='textopm']").val('');
jQ("textarea[name='textopm']").val(MyName + " Inschrijven kan je doen .... bedrag, zijnde € " + Total.toFixed(2) + "over te ....");
});
});
</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
https://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com


Registered User
12 posts

Thanks !!!

Everything works great now !!!

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.