Go Premium for a chance to win a PS4. Enter to Win

x

JavaScript

120K

Solutions

41K

Contributors

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have lead form in Dynamics CRM. In javascript, how can I capture SAVE button event in CRM? The save button is on the top of the CRM. Basically, all i need is when someone click on save button, it will validate one field called 'firstname' and ensure it has value.

That's all.

Thanks
0
Vote for the Most Valuable Expert
LVL 7
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

This javascript function uses a variable (newPrice)

I need to include it in the savedata.asp as a variable to be passed like &newPrice=(I dont know how to insert the js newPrice Variable) newPrice is already defined properly, it has a proper value

$("img#otro").on("click",function(){
 if(send && Validate("form[name=forma]")){
  send=false;
  $("form[name=forma]").ajaxSubmit({url: 'savedata.asp?origen=Otro&newid=<%=Request.Cookies("newid")%>&evento=<%=Request.Cookies("evento")%>&referer=<%=referer%>', type: 'post', success: function(){
   $( document ).ready(function() {
	DrawCaptcha();
	totalPrice += newPrice;
    document.forma.reset();
    send=true;
    alert(totalPrice);

Open in new window

0
I need a JavaScript Regex to do the following:

Example 1 - String = '0:9,1:5,2:6,3:1'  
Example 2 - String = '5:8'

I want to return everything after the ':' and before the ','.

Example 1 result:
9
5
6
1

Example 2 result:
8

Thanks
0
I have a web application in asp.net where i'm using JavaScript Popups. On one popup i have a Link which redirect me to new popup.
Now situation is when i close that new popup i can see my old popup on screen in IE11 but this is not working in chrome. In chrome link on popup redirect me to new popup but my old popup get minimized.  So when i close new popup i need to search my old popup on task bar.

i want this to work same as IE11. Please give some solution.
0
I have a paging system on my app that allows the user to click a link, an ajax call is made to get data, and that data is displayed. I'd like to make it so that the user can only click the link once, then somehow "disable" the link, execute my ajax call, then re-enable the link. I thought I could use bind() / unbind(), but am having trouble getting it to work. This is what I have:

    $('#btnNext').click(function (e) {
        if (currentPage == totalPages)
            e.preventDefault()
        else {
            $('#btnNext').unbind();
            move('next');
            $('#btnNext').bind("click", handler('next'));
        }
    });

    var handler = function ( direction ) {
        $('#dvResults').hide();
        move( direction );
        $('#dvResults').fadeIn(600);
    }

function move( direction ) {
....
}

Open in new window


for whatever reason, it pages twice (if i'm on page 1, it goes to 2, then 3), then i lose all functionality from the link.

Is this the best way to do this, or is there another way to do it?
0
I have a responsive handburger menu on this site: http://taliance.com
Its a wordpress site running Genesis Theme Framework with a child theme.

You need to scroll down 150px to see the menu, and set your dev console to look at it as a mobile.

It nearly works how we want it, but it doesn't slide back to the left when an item is clicked.
Normally this needn't be a problem. It was designed for linking to other pages. But this menu's links go to ids on the same page, using the PageScroll2id plugin. So, as you'll see, it remains in place.

Can you tell from the dev console what I need to do, either with js/jquery or with css to make it slide away when an item is clicked?

Thank you
0
Hello Experts,

Could anyone point me in the right direction on how to get started with GMail Calendar Integration.

I'm building an internal web application using PHP/MySQL, JS/jQuery, and I need to schedule follow-up appointments within my app.  So, within my app I need to:

-Have a button that would open a popup showing the availability from GMail Calendar.

-Be able to book the appointment within the popup, or otherwise. But, still have it set within GMail, returning the date, time, and any type of Appointment ID.

-At a later time, reschedule the appointment, if needed. That's why I'm thinking I need to have an Appointment ID returned from GMail?

I'm also aware that for this, I may need to use AJAX, which I have done only in JS, but I'm hoping to save and keep any creds within PHP for security purposes?

Any help will be greatly appreciated.
0
I have a javascript function that gets data from a selected file. I get the name of the file from the file control using getelementbyid, here: var fileSelected = document.getElementById('txtfiletoread');

I do not have much experience with javascript. How can I append text to the file name? The file may be TestFile.txt, but I want ot change it to TestFile.txt:moredata

Would it be something like this: var fileSelected = document.getElementById('txtfiletoread') += ':moredata';
0
I have table in database "customer"
and this columns:
id, name, father_name, surname, adress
I want, in select box will be name (father_name) surname, and when I select that I want to autopopulate text input filed "adress". So, I need help with showing value in input field "adress". I use this to make drop down select box:

$link = dbConnect();
$query ="SELECT * FROM customer";
$result = mysqli_query($link,$query);

<select name="customer" >
    <?php while ($line = mysqli_fetch_array($result, MYSQL_ASSOC)): ?>
   <option value="<?php echo $line['ime'];?>" "><?php echo $line['ime'];?> <?php echo $line['surname'];?></option>  
   <?php endwhile; ?>
    </select>

Please help me with this, I try this from this link:
http://jsfiddle.net/d3htjbup/ but not success.
I put javascript in this tags: <script></script>

Thank you
0
I am looking for a script (PowerShell or JS) that will create multiple Calendar overlays for a SharePoint online Calendar. I found some for SharePoint 2013, but it does not work for SharePoint online. When creating a SharePoint site template, Calendar Overlays are stripped. Unless anyone can think of another way of automatically creating them, Scripting seems the way to go.

Any help will be great. Thank you.
0
What does it mean to be "Always On"?
LVL 5
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

I've got an excel file stored in base64, that is retrieved in a jquery ajax.get call. The base64 data is then converted back into .xlsx file, and attached to a download <a> tag, for the user to click and download the .xlsx file. I get 2 errors: the first error is: jquery.min.js:3 Uncaught TypeError: Cannot read property 'createDocumentFragment' of null.

The 2nd error happens when I click on the download link: Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
Not sure if 2nd error is related to the 1st one or not. My code is as following:

HTML code:

<a id="downloadlink" onClick="return DownloadExcel()">Download Excel File</a> 

Open in new window


JS code:

//download excel func
function DownloadExcel( file, filename) {
    //debugger;
    var blob = base64toBlob(file, "data:application/vnd.ms-excel;")
    if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
        return navigator.msSaveOrOpenBlob(blob, filename);
    }
    else{
        console.log("inside else of downloadexcel");
      var objectUrl = URL.createObjectURL(blob);
        var downloadLink = $("#downloadlink");
        downloadLink.href = objectUrl; //uri;
        downloadLink.download = filename;
       // document.body.appendChild(downloadLink);
       $(document).append(downloadLink);
    }
  }
  
  function base64toBlob(b64Data, contentType, sliceSize) {
    contentType = contentType || '';
    sliceSize = sliceSize

Open in new window

0
Hi,

I have data in three columns in the database that represents three levels.
Column 'Amt' is the top level
Column 'Herred' is the middle level
Column 'Sogn' it the bottom level

I have made this page: http://kroweb.dk/gfdev/dropdown/ where I have the three levels represented in three select boxes.

What I need is this:
The 'Amt' box should reflect a dropdown box with the content of the column 'Amt' in the database
The 'Herred' box should reflect a dropdown box with the content of the column 'Herred' within the chosen 'Amt'
The 'Sogn' box should reflect a dropdown box with the content of the column 'Sogn' within the chosen 'Amt' and 'Herred'.

I have this HTML (commented where I believe something more is needed :) :
                    <!-- Søge felter -->
        <div class="container" style="width:100%;padding-top:10px;background-color:#f6f6f6;">

            <!-- HEADER START -->
            <div class="row" id="header">
                <form method="POST" style="margin-left:30px;"> 
   

                     Amt                        
                        <select id="amt" name="amt">
                        <option value=""></option>
                        <option value="Content of column 'Amt'">Content of column 'Amt'</option> <!-- something else needed -->
                
                    </select>

                   Herred                        
                        <select id="herred" name="herred">
                        

Open in new window

0
I get undefined message in this code.

controller code:

$scope.searchOutputLst=[];
$scope.searchOutputLst=MyService.retrieveData($scope.caasSearch); // this http call returns data : an array of objects
console.log($scope.searchOutputLst); // prints undefined

Open in new window


 what is the issue ?

I am using angular js 1.3
0
The following chart has a filter applied, keyword "bingo"

https://fusiontables.google.com/DataSource?docid=1Gk2Gpw70hvXqjDoXVcAu8G_7xTwIv4jrhsHiEkL7#chartnew:id=4

Unfortunately the HTML publishing feature does not seem to work (the filter gets removed)

Is there any workaround i can use to publish the filtered version of the chart (apart from creating a new table with the filtered data)?

I want to be able to show the chart on it's own.

This question is as aside from https://www.experts-exchange.com/questions/29069155/Creating-a-dynamic-query-for-Google-Fusion-Tables.html

Thanks
0
If you look at the Orography tab in the attached file there is a graph. The blue line represents a hill or ridge. The dots represent the position of a scaffold on the hill. On the left is the upwind side and there is an orange line. If the scaffold is above this line then it is affected by the terrain and a set of equations need to be checked. I want to shade above the line. On the right is the downwind side. I want to shade below the grey line down to blue. I can introduce dummy nodes to place a node on the blue line directly under the grey line node. I can do the same the other side at 0,900. I cannot find how to shade these areas?
graph.xlsx
0
Hi.

I have a script with two variables. I need both outputs on separate lines.

The first line should read: Receipt required at: "15:15"
The second line should read: Receipt required at: "15:15" and at "20:15" before close

I'm having troubles with the code below in outputting both lines on separate lines, and adding inverted commas to the time variable.

<font font size="4" face="verdana" color="blue">Requester</font><p>
<p><input type="text" id="a" value="15:15"></p>
<p><input type="text" id="b" value="20:15"></p>
<p><font font size="2" face="verdana" color="blue">Click "generate" for response...</font></p>
<button onClick="myFunction()">Generate</button>
<p id="Request"></p>
<script>
function myFunction() {
    var a = document.getElementById("a").value;
    document.getElementById("Request").innerHTML = "<span style='color: grey;font-size: 75%;font-family: verdana;'>Receipt required at: '" + a + "'"
    var a = document.getElementById("a").value;
    document.getElementById("Request").innerHTML = "<span style='color: grey;font-size: 75%;font-family: verdana;'>Receipt required at: '" + a + "' and at + b+ "before close"
}
</script>

Open in new window

0
Hello Experts,

I have coped and pasted the following javascript into my application, see image, but I keep on getting the error message shown in the image.
module.exports = function (context, req) {
    context.log('JavaScript HTTP trigger function processed a request.');
    if (req.body && req.body.name && req.body.id && req.body.age && req.body.address){

    context.res = {
        //status: 200, /* Defaults to 200 */
        body: "Data is saved for user " + (req.body.name) +" !!"
    };

     context.bindings.outputDocument = JSON.stringify({
         id: req.body.id,
         name: req.body.name,
         age: req.body.age,
         address: req.body.address
     });
}
else {
    context.res = {
        status: 400,
        body: "Please pass all user details"
    };
}
context.done();

};

Open in new window

Can someone let me know where I'm going wrong?

Thanks

Carlton
0
Do you know why the first click on button does not work? It actually does not do anything.
However, when i click 2 times, it works.


             <form role="form" class="search-form"  >
                                                <div class="form-group">
                                                    <input required type="email" class="form-control" 
                                                           id="search" name="search" 
                                                           placeholder="Enter your email">
                                                    <button id="gotoNext" name="gotoNext" onclick="fnNext()" class="btn btn-theme" type="button">
                                                        Get Started <i class="fa fa-chevron-right"></i>
                                                    </button>
                                                    <br />
                                                    <label style="color:white;">Your Information is safe & secure</label>
                                                </div>
                                            </form>
                                            <script>
                                                        function validateEmail($email) {
                                                          var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                                                          return emailReg.test($email);
       

Open in new window

0
Hello - I've tried a handful of different code samples, but can not figure out how to add a search box to an Angular 2 table.

Here is my app.component.html code

<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
  <h1>
    Welcome to {{title}}!
  </h1>
  <img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<div>
  <input [(ngModel)]="query">
  <div *ngFor="let user of users | search:'id':query">{{user.id}}</div>


<table class="table">
<ng-container *ngFor="let user of users">
      <tr>
        <th>First Name</th><td>{{user.firstName}}</td>
        <th>Last Name</th><td>{{user.lastName}}</td>
      </tr>
      <tr>
        <th>Job</th><td>{{user.job}}</td>
        <th>ID</th><td>{{user.id}}</td>
      </tr>
    </ng-container>
</table>
</div>

Open in new window



and here is my app.component.ts code

import { Component } from '@angular/core';
import { Pipe, PipeTransform } from '@angular/core';


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'hello';
  users = [
    {
        "firstName": "Clark",
        "lastName": "Kent",
        "job": "Reporter",
        "id": 20
    },
    {
        "firstName": "Bruce",
        "lastName": "Wayne",
        "job": "Business Owner",
        "id": 30
    },
    {
        "firstName": "Peter",
        "lastName": "Parker",
        "job": "Photographer",
        "id": 40
    },
    {
        "firstName": "Tony",
        "lastName": "Stark",
        "job": "Business Owner",
        "id": 25
    }
]
}

@Pipe({
  name: 'search'
})
export class SearchPipe implements PipeTransform {
  public transform(value, keys: string, term: string) {

    if (!term) return value;
    return (value || []).filter((user) => keys.split(',').some(key => user.hasOwnProperty(key) && new RegExp(term, 'gi').test(user[key])));

  }
}

Open in new window


Where am I going wring. Should the code for the pipe be in a separate file? It did not seem to fix things when I tried...but that's probably because the code is not right.

Any assistance would be greatly appreciated! Thanks!
0
Keep up with what's happening at Experts Exchange!
LVL 11
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

hi,

The following fusion tables chart uses an sql query to populate the chart:

http://enex.net/autorecon/fusion/GC_network.html

How can i edit the query to filter for say keyword "bingo" ? Ideally as a variable so as a follow-up question/project I can link this to a input search box and start developing the page.

<iframe width="1000" height="600" scrolling="no" frameborder="no" 

Open in new window

0
Hi,
To the prompt, after having pressed Password button below. I expect the password strength to be shown, exactly after having input two password (but before Submit button is pressed). What to adjust?
http://my-friend.co/UserMaintenance2/Default.aspx?userid=mc23&readonly=n
0
I was doing something with my wordpress site with DIvi builder, and Divi asked that I deactivate my wordpress plugins one by one to see if they were causing a problem.

I deactivated woo-commerce, which is only on one portion of the site, and I get this: This plugin required woocommerce installed.

That's all I see on the home page. Help!  https://techgardens.com/
0
I have an app where I do a $.ajax and do a get call to an API, which returns a previously converted excel file (excel to base64); I need to re-convert this base64 data back into it's original form - i.e. into Excel file. I tried retracing the steps I took to convert the excel into base64, reversing some of them, but I'm not able to generate the original file. An excel file IS being generated, but it still has base64 data and therefore opens w/ errors and in a corrupted state. Has anyone else successfully done this?

Below is my code and fiddle link: (I didn't add the base64 json data (responseData) here since it's large, but it's on the fiddle)

var bindata = window.atob(responseData);
function DownloadExcel() {
  window.location.href = "data:application/vnd.ms-excel;base64, bindata"
}
var blob = new Blob([responseData], {type: 'application/vnd.ms-excel'});
if (window.navigator && window.navigator.msSaveBlob) {
    window.navigator.msSaveBlob(blob);
}
else {
    var objectUrl = URL.createObjectURL(blob);
    window.open(objectUrl);
}

Open in new window



Fiddle link: https://jsfiddle.net/damon_matt/2ofz6xrd/14/
0
hi,

I'd like the resize this frame depending on the window size, how can i do this?

URL: http://enex.net/autorecon/fusion/bm_network.html

<iframe width="1000" height="600" scrolling="no" frameborder="no" src="https://fusiontables.google.com/embedviz?containerId=googft-gviz-canvas&amp;viz=GVIZ&amp;t=GRAPH&amp;gc=true&amp;gd=true&amp;sdb=1&amp;rmax=100000&amp;q=select+col0%2C+col2+from+1pNOeGhfGxNU9RvFgGMC5egdSprZL-6q50jt9anr5&amp;qrs=+where+col0+%3E%3D+&amp;qre=+and+col0+%3C%3D+&amp;qe=&amp;uiversion=2&amp;state=%7B%22ps%22%3A%221_0_1w_1_t_3a_1_x_-f_u_5_k_d_w_-c_1_m_13_-u_12_-16_b_16_e_-1i_8_2j_s_9_2o_m_4_1n_y_3_1x_-10_2_10_-c_a_2p_-j_6_20_z_q_1d_-q_b_2l_-p_c_1a_s_d_2a_-x_e_2s_-c_f_1t_11_g_27_z_y_3z_-k_i_1q_-x_j_23_-x_k_2t_-3_l_2d_v_n_2f_-s_o_15_-j_p_11_e_r_1j_-w_s_2r_g_u_1g_w_v_y_-4_13_-15_1f_z_46_9_10_3z_n_11_46_-6_1_z_5_14_-p_1p_15_-1b_z_7_2t_8_17_-e_-1x_h_15_m_%22%2C%22cx%22%3A85.96027096386045%2C%22cy%22%3A8.76855179300828%2C%22sw%22%3A639.789842687397%2C%22sh%22%3A245.5175468552088%2C%22z%22%3A0.999142241431289%7D&amp;gco_forceIFrame=true&amp;gco_hasLabelsColumn=true&amp;width=1000&amp;height=600"></iframe>

Open in new window


Thanks
0
On HTML page I want to keep TEXTAREA controls read-only until the user starts typing characters. All other keyboard events should not change the read-only status. In my script, on the first typed character event the handler makes the control not read-only, but that character does not go to the control itself.
I tried to do the following:
$(".textarea").keyup( function(ev) {
    var k = ev.keyCode;
    var inp = ev.target;
    if(  inp.readOnly && k >= 42 && k <= 90 ) {  // an alphanumeric
    	inp.readOnly = false;
        inp.select();  // without this IE do not accept typed in characters at all
        // i tried this:
    	var sev = $.Event("keypress", {keyCode: k, which: k});
        // and that:
    	var sev = $.Event("keypress", ev);
    	$(inp).trigger(sev);
    }
} );

Open in new window

Whatever I tried, the first typed character is lost, the second goes to the control.
0

JavaScript

120K

Solutions

41K

Contributors

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.