1. #11
    Sencha User
    Join Date
    Apr 2007
    Posts
    66
    Vote Rating
    0
    cgi-bin is on a distinguished road

      0  

    Lightbulb


    Maybe rename emptyText to defaultValue since thats what it seems its intended use is and would be less confusing. Then also add helpText parameter which would never be submitted?

  2. #12
    Ext User
    Join Date
    Jun 2007
    Posts
    11
    Vote Rating
    0
    kilrae is on a distinguished road

      0  

    Default


    Quote Originally Posted by djliquidice View Post
    Jack,

    Empty text is assumed to be used as a helper for customers. I realize what you're saying, but I also assumed it as well. I've since stopped using empty text where fields are not required to be filled in.


    Eh, i can see both sides of the fence being right. Perhaps an option to not send the empty text value?
    Especially as the emptyText is displayed differently (greyed) and disappears when you click on the field unlike regular text.

  3. #13
    Ext JS Premium Member sebsei's Avatar
    Join Date
    May 2007
    Location
    Copenhagen, Denmark
    Posts
    69
    Vote Rating
    0
    sebsei is on a distinguished road

      0  

    Default


    I had the same problem as other users in this thread, and find it a little unlogical that the getValue() function of a field returns '' if the field is empty and emptyText is set, but when you submit the form with form.submit() the emptyText values are submitted.

    I'm using the following solution, which I think is a little cleaner, as you don't have to put it directly in the Ext source, but can include from somewhere else. Another thing is that if errors are returned from server side, the emptyText values will be put back on the fields.


    HTML Code:
    Ext.form.Action.Submit.prototype.run = Ext.form.Action.Submit.prototype.run.createInterceptor(function() {
      this.form.items.each(function(item) {
        if (item.el.getValue() == item.emptyText) {
          item.el.dom.value = '';
        }
        });
     });
    Ext.form.Action.Submit.prototype.run = Ext.form.Action.Submit.prototype.run.createSequence(function() {
      this.form.items.each(function(item) {
        if (item.el.getValue() == '' && item.emptyText) {
          item.el.dom.value = item.emptyText;
        }
        });
     });

  4. #14
    Ext User
    Join Date
    Dec 2007
    Posts
    1
    Vote Rating
    0
    feishu is on a distinguished road

      0  

    Thumbs up


    THX, That's good

  5. #15
    Ext User
    Join Date
    Jun 2008
    Posts
    5
    Vote Rating
    0
    oxyum is on a distinguished road

      0  

  6. #16
    Ext User
    Join Date
    Aug 2009
    Posts
    2
    Vote Rating
    0
    broady is on a distinguished road

      0  

    Default


    My solution:
    Code:
    Ext.onReady(function() {
        Ext.select("form").on('submit', function() {
            Ext.each(Ext.ComponentMgr.all.items, function() {
                if (typeof this.getValue == "undefined" || typeof this.el == "undefined") return;
    
                if (this.getRawValue() != this.el.getValue())
                    this.setRawValue("");
            });
        });
    });

  7. #17
    Sencha User SabaSarwat's Avatar
    Join Date
    Sep 2010
    Posts
    70
    Vote Rating
    0
    SabaSarwat is on a distinguished road

      0  

    Default


    Broady, this solution did not work for me.
    and sebsei where to add lines if i don't have any html file, i have a .jsp

  8. #18
    Sencha User
    Join Date
    Dec 2008
    Posts
    27
    Vote Rating
    0
    hitekshu is on a distinguished road

      0  

    Default f.el is undefined

    f.el is undefined


    I am using Extjs 3.4 and there is an error "f.el is undefined" which is thrown if the element is a radio button. Any fix for this one?


    Quote Originally Posted by trbs View Post
    okey i wrote a small workaround for this.
    i'll have to say that i think this patch is less then ideal and i do not recommend patching ext in this way... but if you really want this problem solved try this:

    add the following lines of code to Action.js line 108:
    PHP Code:
      if (o.clientValidation === false || this.form.isValid()){
        
    this.form.items.each(function(f) {
            if (
    f.el.getValue() == f.emptyText) {
                
    f.el.dom.value '';
            }
        });
        
    Ext.lib.Ajax.formRequest
    The first and last line of the code block are the existing lines. You'll need to add the this.form.items.each block between them.

    Explanation
    The form.submit() action uses a form serializer instead of the getValue() field functions the raw dom value is send to the server. (this is the value including emptyText if the field is empty)

    So the fix posted above does work, only not for a form.submit() action. Since i do not want to start editing in files other then those of ext themselfs. I build the above work around.

    Just before the XHR submit-request to the server, this deletes the emptyText value from the dom. Then when the Ext.lib.Ajax.formRequest serializes the form there is no emptyText in there anymore.

    The next time the form validates itself, the emptyText will reappear.

    Related problems
    You will also hit this problem if you use: form.getValues() as that method also uses the serializer.
    This patch will not work for that, but i could use a similar workaround. (again remember, this is not very good
    way to work around this... hopefully the ext team will come up with something better, like using getValue() methods or serializers that check for emptyText)

    Attachment
    The patched file attached here is based on the Ext 1.0.1 release.
    Please apply the workaround yourself or do a diff; if you want to apply it on any other version.

    Post Scriptum
    If your client types the same value as emptyText in your Field the workaround will not do the desired thing. It will consider the typed value the same as emptyText, which it is clearly not. For 9 out of 10 people this will not be a problem, but if it is you should also check the css (aka the light grey text, instead of black typed text)

  9. #19

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi