'paste'에 해당되는 글 1건

  1. 2017.09.07 [extJs] 텍스트 필드에 값 붙여 넣으면 읽어서 치환.

 

/*

텍스트 필드에 값을 붙여 넣은 경우 그 값에서 공백을

콤마로 치환하는 예제.

 

If you paste a value into a text field,

Example of replacing with a comma.

*/

 

 

<html>

<head>

</head>

<link rel="stylesheet" type="text/css" charset="UTF-8" href="./theme-gray-all.css" />

 

<style type="text/css">

</style>

 

<script type="text/javascript" charset="UTF-8" src="./ext-all.js"></script>

 

<body>

 

<script language='javascript' >

 

Ext.onReady(function(){

 

  Ext.create('Ext.form.Panel', {

      title: 'Contact Info',

      width: 300,

      bodyPadding: 10,

      renderTo: Ext.getBody(),

      items: [{

          xtype: 'textfield',

          name: 'name',

          fieldLabel: 'Name',

          allowBlank: false  // requires a non-empty value

          ,

          listeners: {

            paste: {

              element: 'inputEl',

              fn: function(event, inputEl) {

               setTimeout(function(){

                 var temp1 = ( inputEl.value  ).replace(/ /g,",");

                 inputEl.value = temp1;

               },0);

              }

            }

          }

      }, {

          xtype: 'textfield',

          name: 'email',

          fieldLabel: 'Email Address',

          vtype: 'email'  // requires value to be a valid email address format

      }]

  });

    

    

});

Posted by 혜화초보
,