We have a Requirement, where Business always discuss to Increase or Decrease the Target sales value by some Integers, accordingly we have Input Enabled SAP WAD report which gives sale numbers. Moreover Now we have developed all of the Necessary Configuration to perform this %Increase Function but need this precise Javascript code optimization on my existing code.
Logic is, I Select the Required multiple row Cells and subsequently admit to press the %Increase Button, a Prompt will pop-up and enter the required integer Values and say OK.
So,for that Input provided integer value, back-end code should perform the %Increase calculation and insert back to respective cell.
x = (Input Value/100)X Cell Value;
Result = Cell value X x
Here I need your help fix the Javascript syntax correction.
The below Code performs 80% of my required function, but only need 20% of modification on that.
function sapbi_rig_plan_Per_Increase(content){
if ('undefined' == typeof(content) ) content = '';
if (content == null) content = '';
var info = sapbi_rig_plan_inf;
if (sapbi_rig_plan_isValidState(info) === false){
alert('Please select the range.');
return;
}
var content = prompt("Please enter value", " ");
if (isNumber(content ) == true){
var cell;
for(var cntSel = 0; cntSel<info.activeSel.length; cntSel++){
cell = document.getElementById(info.activeSel[cntSel][0]);
var fact = (content/100)*cell;
var content1 = fact+cell;
sapbi_rig_plan_setContent(cell, content1);
}
} else {
alert('Please Enter the Valid Qty only');
}
}
Please Note : I am Not java Developer, i am SAP BW-IP Developer
Related
I've created a web app where you can search for the employee details using app script.
I have a single input textbox and some disabled fields to display some data.
Actual Web App
Here's the code
The input field length is 7 numbers only and what I want is, when I delete 1 number and the length becomes 6 the disabled field will be empty.
Is there a way to do it? Thanks!
add input listener for #zip input
try this :
document.getElementById("zip").addEventListener("input", function(){
if((this.value).length < 7){
document.getElementById('est').value = "";
document.getElementById('Eadd').value = "";
document.getElementById('role').value = "";
document.getElementById('rd').value = "";
document.getElementById('prod').value = "";
document.getElementById('Aht').value = "";
document.getElementById('Ave').value = "";
}
});
I have a form that needs to be digitally signed. After the form is signed, all form fields are made readonly from the properties. But my buttons are not hidden.
What can I do to hide the buttons??
PS - I am using acrobat 15
There seems to be no in-built function or property to achieve the desired result. But I got a simple javascript that I could use to make all fields readonly and hide all buttons both at the same time.
for ( var i = 0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
if(fname.type == "button")
{
this.getField(fname).display = display.hidden;
}
else if ( fname != "Signature_2" )
this.getField(fname).readonly = true ;
}
Specifically, what I am trying to do is reference the value of a form box to use in a function, based on a radio button selection.
Here's the applicable code parts:
var salaryBox = document.forms[0].salary;
function getFedTax() {
var fedTax = 0;
var income = salaryBox.value;
if (document.getElementById("single").checked) {
if (income >= 8350) {
fedTax = income * .10;
messageElement.innerHTML = "Your federal tax amount is: " + fedTax;
}
}
}
This function is based on the first radio button (Single) being checked. If checked, and the salary box value is >= 8350, I want it to perform that calculation and display it in the messageElement section of the HTML.
Here's the full code on fiddle: http://jsfiddle.net/3fqv2jwa/10/
Also, if anyone knows why my function getStateTax() in the code isn't displaying properly in the el.innerHTML, I would appreciate help with that as well!
I have the following validation code on my .asp webpage. I also need to validate the txtndc textbox so that the data entered looks like this. 00000-0000 Currently they can enter any info in this textbox. The entry should always be 5 numbers a dash and 4 numbers. Any help would be greatly appreciated.
function form_onsubmit() {
if (form1.txtdrug.value == "")
{
alert("Drug Name Needed");
return false;
}
if (form1.txtndc.value == "")
{
alert("NDC Number Needed");
return false;
}
if (form1.txtndc.value != "" && form1.txtdrug.value != "")
{
alert("Drug was Successfully entered into the database, hit enter to continue.");
return true;
}
}
How would the syntax be written. The textbox i am trying to check is
<input type="text" name="txtndc" size="35">.
I am not sure how to enter your code below above into my page. Please Help
Using Javascript regex#test function.
x = /^[0-9]{5}-[0-9]{4}$/;
console.log(x.test("12113-1234"));
>>> x = /^[0-9]{5}-[0-9]{4}$/; console.log(x.test("00000-0004"));
true
Demo: http://jsbin.com/axikiv/1/edit
I have seen a few of these jquery things going on, and just wondered if there was a simple number formatting script.
Essentially, all we wish to do, is format ( client side ) for checking purposes only, the number entered in a field. To show somewhere else on the page ( presumably in a div ) the formatted price they entered.
So lets say, field
input id="price" name="price" size="50" type="text" class="medium" /
And they enter 1234560
I want to show somewhere else on the page, :
You Entered : $1,234,560.00 as the price. Is this correct ?
This is only for visual purposes only. Alternatively, changing the value of what they type and formatting it "live" could be an option, however the value we want to send to the db is pure numerics, ie: 1234560
Setup a function like this one
Javascript format currency
function CurrencyFormatted(amount) {
var i = parseFloat(amount);
if(isNaN(i)) { i = 0.00; }
var minus = '';
if(i < 0) { minus = '-'; }
i = Math.abs(i);
i = parseInt((i + .005) * 100);
i = i / 100;
s = new String(i);
if(s.indexOf('.') < 0) { s += '.00'; }
if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
s = minus + s;
return s;
}
Then set an onchange for jQuery something like this
jQuery(document).ready(function(){
jQuery('#price').change(function(){
jQuery('#mydivsomewhere').val(CurrencyChange(jQuery('#price').val()));
});
});
Not sure if that is 100% correct, haven't tested it. But should call CurrencyFormat whenever the text in your input box changes. Should pass in the val of the textbox with id of price and set a div of id mydivsomewhere with the formatted value.