1

I'm having a problem with some apex:inputtextarea I have in my page. It's very similar to the situation described on this post; the thing is that I'm not doing any of the things that could cause this according to the post's answer. Or al least I don't think i am. I do have a little script function to validate if the fields are empty, that is fired when I click Save.

I've tried changing it to apex:inputText, apex:inputField; I even created a inner object in my controller to be used as a "bridge" between what's written in the page and what goes to the actual object that is saved. And my form is submitting just the variables are coming of null.

vf page:

<div class="title-form text-bold">Title:</div>
<apex:inputtextarea id="msg1" value="{!msg.title}" rows="2" cols="100"/>

controller:

public class Controller {

   public class MessageObject {
      public String title { get; set; } 
   }    
   public MessageObject msg { get; set; }

   (...)

   public PageReference saveChanges() {
      obj.Message_title__c = msg.title;
      update obj;
   }
}

Could someone point me to the light... or suggest a workaround for this.

Thanks in advance.

Best regards,

ECLF

  • I have faced this before when I had a command button with the immediate attribute set to true. – Richard N Aug 12 '13 at 22:22
  • 1
    Are you instantiating msg anywhere? msg = new MessageObject(); ? – Boris Bachovski Aug 12 '13 at 22:41
  • E-bacho is right, you never instantiate msg, which is why it is null – Chris Duncombe Aug 13 '13 at 2:41
  • @Richard N -- no immediate=true in my button... and i've checked several times. – eclf Aug 13 '13 at 11:23
  • @e-bacho 2.0 -- yes I am instanciating the object in the constructor... I just didn't post it here with the code. I have this custom object and on the page I can do 1 of 2 things: create (to insert a new record of this obj) and save (to update the current record of this obj). I have a bunch of other fields of this object that can be updated, such as dates, picklist, etc., even the field Name on the object (which is an inputtext) and all of them are updating just fine when I save. They are separeted by sections (but same form) on the page. Could it be it? Thanks for all the replys. – eclf Aug 13 '13 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.