簡體   English   中英

Apex組件控制器無法從apex:inputText / inputField獲取值

[英]Apex Component Controller can not get value from apex:inputText/inputField

我有一個簡單的自定義組件,我想用來發送電子郵件。 結構是這樣的:

<apex:form>
    <apex:actionFunction action="{!sendEmail}" name="sendEmail" />
    <apex:inputField value="{!To}"/>
    <button type="button" onClick="sendEmail();"/>
</apex:form>

和一個像這樣的控制器:

public with sharing class emailComponent{
    public string To { get; set; } 

    public void sendEmail(){
        system.debug(logginglevel.info,To);
    }
}

現在,當我觸發actionFunction時,將調用正確的方法,但“ To”的值將始終為null。 即使我在調用該方法時在構造函數中設置該值,該值也將為null。 我不知道這是否與作為自定義組件控制器有關,或者我是否還缺少其他東西。

將“ rerender”屬性添加到apex:actionFunction,它應該開始工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM