Results 1 to 3 of 3

Thread: Urlfield working, innerHtml doesn't

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    104
    Answers
    4
    Vote Rating
    0
      0  

    Default Unanswered: Urlfield working, innerHtml doesn't

    Hi everybody, I have a problem, when I try to use a urlfield, this is my component:

    Code:
    xtype: 'urlfield',
    label: 'Telephone',
    //name: 'TEL_NUMBER',
    readOnly: true,
    listeners: {
    	'painted': function(ele) {
    		var record = solicitanteOC.getRecord();
    		if (record.data.TEL_NUMBER != '') {
    			//ele.setValue('<a href="tel:' + record.data.TEL_NUMBER + '"></a>');
    			ele.setHtml('<a href="tel:' + record.data.TEL_NUMBER + '">' + record.data.TEL_NUMBER + '</a>');                                
    		}
    	}
    }
    Url is working, but when I see it in my page, I don't know what happen but it looks like this:

    bb90563ba0b24b60bfacb89.png

    2 lines in the field? one in blank and the other with the url ... what do i have to do?

    thanks in advance!

  2. #2
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Answers
    124
    Vote Rating
    91
      0  

    Default

    Hi!
    Actually, it is not an empty space , it is an input field.

    The Url field creates an HTML5 url input or you may say, the url field is just a normal text field.

    Because url field inherits from textfield it gains all of the functionality that text fields provide, including getting and setting the value at runtime, validations and various events that are fired as the user interacts with the component.

    Sample:-
    Code:
    {
           xtype: 'urlfield',
           label: 'Url'  ,
           html:'<a href="#">Sample Anchor</a>'
     }
    urlField.png

    For More info on urlField, check this:-
    http://docs.sencha.com/touch/2-0/#!/api/Ext.field.Url
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    104
    Answers
    4
    Vote Rating
    0
      0  

    Default

    Yeah, urlfield is just a type of textfield, so that not works for me.
    I resolve this "issue" "making up" the field with a css and adding focus() in the listener of the field:
    I hope it can be useful to others.

    Code:
    .x-input-url
    {
        color:Blue;
        text-decoration:underline;
        font-size:16px;
        cursor:pointer;
    }
    Code:
    xtype: 'urlfield',
    label: 'Telfono',
    readOnly: true,
    name: 'TEL_NUMBER',
    listeners: {
    	'focus': function(ele) {
    		var nombre = solicitanteOC.getRecord().data.NAME_TEXT;
    		var nro = solicitanteOC.getRecord().data.TEL_NUMBER;
    		if (nro) {
    			Ext.Msg.confirm('Contacto', 'Llamar a ' + nombre + "?", function(res) {
    				if (res == 'si') {
    					window.location = 'tel:' + nro;
    				}
    			}, this);
    		}
    	}
    }
    Thanks anyway!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •