|
Looking at the documentation, you need to modify your calculation to use either an if_else expression:
$('form#Commission #Commission_On').formCalc("if_else(Nett_Earnings > Actual_Takings, Nett_Earnings - Actual_Takings, 0)", { currency_format:true, mirror:'sfm_Commission_On_parsed' }); or the max function:
$('form#Commission #Commission_On').formCalc("max(Nett_Earnings - Actual_Takings, 0)", { currency_format:true, mirror:'sfm_Commission_On_parsed' }); Calculation field : function reference| Simfatic Forms 5.0 Help[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard, top code worked perfectly. 
|
|
|
|
|
I really need to create a objectId on the client side, but have been avoiding it because I can't figure out how.
So I added the npm bson-objectid, but can't figure out how to make it work.
I put this in my app.module
export function bsonFactory() {
const ObjectID = require("bson-objectid");
return ObjectID();
}
but it produces this on console.log
BsonFactory= function bsonFactory() {
var ObjectID = webpack_require(/*! bson-objectid */ "./node_modules/bson-objectid/objectid.js");
return ObjectID();
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I am writing a javascript to format JSON objects to array of JSON objects.
My input is,
{
Name:"nom1",
Cities:['city1','city2']
}
{
Name:"nom2",
Cities:['city4','city5']
}
And I want the output as,
var data = [ { Name:"nom1", Cities:['city1','city2'] }, { Name:"nom2", Cities:['city3','city4'] } ]};
|
|
|
|
|
Try this
<script>
var nom1 = { Name:"nom1", Cities:['city1','city2'] };
var nom2 = { Name:"nom2", Cities:['city4','city5'] };
var snom1 = JSON.stringify(nom1);
var snom2 = JSON.stringify(nom2);
var array = [ snom1, snom2 ];
document.getElementById("demo").innerHTML = array;
</script>
|
|
|
|
|
Hi I want to create a matrix 'B' like given below while I only have an array 'A'
A=[0 1 2 3 4]
B= [0 1 2 3 4
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8]
For some reason, these few lines are not working
for (var i=0;i<5;i=i+1){
for (var j=0;j<5;j=j+1){
B[i][j] = A[j]+i;
}
}
Any help or suggestion will be appreciated.
Thanks
|
|
|
|
|
Try this
<script>
A = [0,1,2,3,4 ];
var B = [];
for (var i=0;i<5;i=i+1){
B[i] = [];
for (var j=0;j<5;j=j+1){
B[i][j] = A[j]+i;
}
}
</script>
|
|
|
|
|
Hello
When In a PHP form I fill a field, an onBlur event validates this field and if an error occurs the my_alert function is displayed.
This is the part of the code that runs my_alert function.
$params = array(
'title' => "Warning",
'type' => "error",
'width' => '350px',
'confirmButtonText' => 'OK');
$desc="The field cannot be empty";
my_alert($desc, $params);
So far everything is ok; the my_alert function work fine.
But I wish that, when the alert window is closed, the focus remain on the invalid field and to do this I created a simple javascript function that contains a single line of code and exactly $('#field_id'). Focus () and that should be done immediately after my_alert.
The problem is that it doesn't work: the focus always goes to the next field.
However, if I remove my_alert, this does not happen.
They suggested me to try to pass $params and $desc directly to the javascript focus function and also run my_alert inside it, but I'm in trouble because I don't know javascript well.
Can someone help me?
Thank You and Best Regards
|
|
|
|
|
a Little late but might help other readers - after setting focus to element, just add return false;
This will stop any other code executing and will add focus to your element as required.
|
|
|
|
|
I am creating a p5js project and I want a code that prints the x and y of an ellipse. When I run the code it just shows up as the original x and y of the ellipse. How would I create a code that always changes the string printed on the screen.
|
|
|
|
|
HI all,
can anyone tell me how this MacID,SystemOs, System Version, and computer name? get from the javascript library.
modified 9-May-20 14:39pm.
|
|
|
|
|
|
I would like to add a marker to the map using the form. Can anyone help me? Installing the map works. I want to display markers after entering x and y, and read this data from the table. I have 2 inputs, one for X and the other for Y after clicking "add" I add this data to the table and I have 2 objects, etc ... but only one marker from state.items is displayed on the map, although I have more coordinates in the table.I know that the componentDidMount () method is only run once and here is the problem.Please Help
state={
items:[{
"X": 13.6155611,
"Y": 51.0331258
},
],
}
addItem = (e) => {
e.preventDefault();
const newItem = {
"Y": parseFloat(this.state.X),
"X": parseFloat(this.state.Y),
};
this.setState(prevState => ({
items: [...prevState.items, newItem]
}));
}
componentDidMount() {
const map = new mapboxgl.Map({
container: this.mapContainer,
center: [this.state.lng, this.state.lat],
zoom: this.state.zoom,
});
for (var i = 0; i < this.state.items.length; i++) {
var obj = this.state.items[i];
let myLatlng = new mapboxgl.LngLat(obj.X, obj.Y);
new mapboxgl.Marker()
.setLngLat(myLatlng)
.addTo(map);
}
}
render() {
return (
<div ref={el => this.mapContainer = el} />
<form onSubmit={this.addItem}>
<input
type="number"
value={this.state.X}
onChange={e => this.setState({
X: e.target.value
})}
/>
<input
value={this.state.Y}
onChange={e => this.setState({
Y: e.target.value
})}
/>
</Form>
)}
|
|
|
|
|
is it possible to use this bootstrap table with data tables plugin? can anyone please help me out... as I want to change the view of datatables views. it looks outdated...
|
|
|
|
|
Try asking the people who wrote it.
|
|
|
|
|
Bootstrap is just css so yes, you can apply it.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Hi,
You could definitely use it. Thanks.
Cheers,
Jin 
|
|
|
|
|
Hi this works, but i would like to add other CountryCodes to include all french speaking countries.
<script language="JavaScript" src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script language="JavaScript">
if(geoplugin_countryCode() != 'US'){
if(geoplugin_countryCode() == 'FR'){
location.href = "indexfr.html";
}else{
location.href = "//index.html";
}
}
</script>
if (Type == 2 && (PageCount == 0 || PageCount == '')) {
as if commented out part worked....
the geoplugin generates the country code
Any help welcome
thanks
Peter
|
|
|
|
|
Member 14807823 wrote: as if commented out part worked. What happens when you uncomment it?
|
|
|
|
|
Hi Richard,
The commented part was to illustrate what I was trying to do, it wont work.
so it wont go to the indexfr.html page
Thanks
Peter
|
|
|
|
|
I think your syntax is not correct, try this:
var cc = geoplugin_countryCode();
if (cc == 'FR'|| cc =='CH' || cc =='LU' || cc =='BE' || cc =='LI'){
location.href = "indexfr.html";
}
|
|
|
|
|
Hi Richard,
Yes it was the syntax,
that was the neat and correct solution
Thanks
Peter
|
|
|
|
|
Yes, and I should have spotted it the first time. I will try harder in future. 
|
|
|
|
|
It looks like all you need to do is debug it. I'm not sure what you were wanting us to do.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Hi Richard
Mainly I wantad to know if that should work, looking around is seems not to be correct..
I dont know how to debug it.
thanks
Peter
|
|
|
|