You need to sign in to do that
Don't have an account?
Assignto param
<apex:page showheader="false" sidebar="false" controller="searchFlightsController" standardstylesheets="false">
<apex:form style="font-size:13pt">
<h1 style="text-align:center;color:black;"> Search for Flights </h1>
<apex:pageBlock title="Search for Flights">
<apex:pageblockSection >
<apex:inputField value="{!flight.departureCountry__c}" /><br/>
<apex:inputField value="{!flight.Departure__c}" />
<apex:inputField value="{!flight.destinationCountry__c}" /><br/>
<apex:inputField value="{!flight.Destination__c}" />
<apex:inputField value="{!flight.dayOfDeparture__c}"/><br/>
<apex:inputField value="{!flight.timeOfDeparture__c}" />
<apex:inputField value="{!flight.dayOfArrival__c}" /><br/>
<apex:inputField value="{!flight.timeOfArrival__c}" /><br/>
<apex:commandButton rerender="FlightsDetail" action="{!searchFlights}" value="Search for Flights">
<apex:param value="{!flight.dayOfDeparture__c}" assignTo="{!dayOfDep}"/>
</apex:commandButton>
</apex:pageblockSection>
<apex:pageblockSection >
<apex:outputPanel id="FlightsDetail">
<apex:repeat value="{!flightsResult}" var="flightres">
<p>{!flightres.timeOfArrival__c} </p>
</apex:repeat>
</apex:outputPanel>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi, i am having an error assigning the day the user selects (from a list) from a visualforce page. Whatever the day the user selects i want to use it in my controller. the problem is the value is always null. Any helps what i am doing wrong. (higlighted red whats not working) If i make the value monday it works. so i am not getting the value what the user selects i think
Thanks
hi, just a thought. instead of going thru the param thingy...
since the value of select list (<apex:inputField value="{!flight.dayOfDeparture__c}"/>) is supposed to be posted back to the conroller, can't you just use the value of flight.dayOfDeparture__c directly in your controller?
i.e.
All Answers
Try replacing
by
I tried the solution above and still had the same error
is
returning/displaying anything? (on controller-side, using System.debug or View State, etc)
i am selecting a day from picklist (monday, tuesday......sunday) from object class.
Hi,
There is some problem involved into the <apex:commandButton> when you use <apex:param>
You will have to reRender the hiddenBlock to solve this issue.
Here is the blog from Jeff Douglas to solve this issue.
Please refer the above blog.
Hope this helps :)
Thanks,
Devendra
i cant use rerender because i am already using that...do u need to see my class to help me out
Can you please post your VF and Apex code?
Thanks,
Devendra
This is my VF page below. The VF page is used to search for flights. The user has so has to input data on the visualforce page and based on that it will do a search. For now i am doing the search based on the dayOfDeparture which a picklist the user has to choose from (monday to sunday). the problem is i think i am correctly getting the information from the inputfield dayOfDeparture, therefore dayOfDep returns nothing, Here is the VF page
Hi,
Try this:
Now use strDept in the query.
Thanks,
Devendra
Hi,
I did what you requested me to do, but this time the button didnt do anything at all. here is the code i used
and the apex class
Thanks again for you help
hi, just a thought. instead of going thru the param thingy...
since the value of select list (<apex:inputField value="{!flight.dayOfDeparture__c}"/>) is supposed to be posted back to the conroller, can't you just use the value of flight.dayOfDeparture__c directly in your controller?
i.e.