You need to sign in to do that
Don't have an account?
john dsouza
pass value of inputText to controller from visualforce page
Hello
I have a visual force page purely designed using HTML5.
I have a inputText field called email stored inside a custom object preferences.
If the value in the inputText field changes then I want to capture the changed value into my apex controller for further processing.
Here is what I am trying to achieve.
any help will be rewarded.
Thanks
JohnD
I have a visual force page purely designed using HTML5.
I have a inputText field called email stored inside a custom object preferences.
If the value in the inputText field changes then I want to capture the changed value into my apex controller for further processing.
Here is what I am trying to achieve.
public class mycontroller { public String fanEmail{get;set;} } <apex:page controller="mycontroller docType="html-5.0"> <body> <div class="form-group label-floating"> <apex:form <label class="control-label">EMAIL *</label> <apex:inputText value="{!Email}" id="memail" onchange="doSearch()';" styleClass="form-control"/> </div> <apex:commandButton value="SAVE CHANGES" action="{!btn_profile_saveChanges}" styleClass="btn btn-success"/> </apex:form> </apex:page>I know that we can use onchange event of <apex:inputText> to achieve this and create a javascript but not sure how to proceed further.
any help will be rewarded.
Thanks
JohnD
since vf page is an HTML based is it possible to use <apex:inputHidden>,
if yes, pls explain.
thanks
JohnD
Please try
<apex:inputText value="{!fanEmail}" id="memail" // input text value should match your controller variable name to bind.
Yes, you can use <apex:inputHidden> to hide any inputtext field.
Please mark it as Solved if it answers your question.
Thanks
I am doing something like this
public String C1Email{get;set;}
In the vf page:
<apex:inputHidden value="{!C1Email}" id="changedemail"/>
<apex:inputText value="{!C1Email}" id="memail" styleClass="form-control"/>
<script type="text/javascript">
var hiddenfield=document.getElementById('{!$Component.PrefForm}').elements['{!$Component.changedemail}'].value;
alert(hiddenfield);
</script>
I am not getting the alert, what I require is whatever email I enter in inputText it should be captured in inputHidden field then from apex controller I will retrieve it.
pls note in vf page , <apex:form id="PrefForm">
please let me know how to proceed further.
thanks
johnD
Please try
var hiddenfield=document.getElementById('{!$Component.PrefForm.changedemail}').value;
if you have page block or any content tags, please include that Id before input field id (changedemail)
Hope this helps!