You need to sign in to do that
Don't have an account?
Refresh Only PageBlock Portion & Link InputText n CommandButton by ENTER key
Hi,
I had developed a Visualforce page which UI looks similar to a ListView with a Search Functionality. My Page has Executed very well but has Several Issues in UI. I had wrote my Issues after the code. Please check Below
<apex:page controller="PortofOriginController" showHeader="false" sideBar="false" tabStyle="Sourcing__tab" id="pg"> <head> <apex:message title="Error"/> <Style> .Body {font-size:14px;font-family:'Calibri';} </Style> <Script type='text/javascript'> function noenter(ev) { if (window.event && window.event.keyCode == 13 || ev.which == 13) { doSearchAF(); return false; } else { return true; } } function writeDB() { location.reload( 0 ); return false; } </Script> </head> <body> <apex:form > <c:Sectionheader iconsrc="{!$Resource.Port_Of_Origin}" title="Sourcing" subTitle="Port of Origin" PrintUrl="https://cs5.salesforce.com/a0R/x?fcf=00BO0000000WWES&rolodexIndex=-1&page=1" help="https://help.salesforce.com/htviewhelpdoc?id=co_view.htm&siteLang=en_US"/> <apex:actionRegion rendered="true"> <apex:outputPanel id="top" layout="block" style=" border: 0 none; font-family: Calibri; height: 24px; float: right; margin-top: -25px; width: 270px;"> <apex:outputLabel value="Search" style="font-weight:Bold;font-family:'Calibri';padding-right:10px;font-size:14px;" for="txtSearch"/> <apex:inputtext value="{!searchString}" id="txtSearch" onkeypress="return noenter(event);" /> <span style="padding-left:5px; "> <apex:commandbutton id="btnGo" value="Go!" action="{!Search}" rerender="searchResults" status="blockUI" style="width:40px;"/> </span> </apex:outputPanel> <apex:outputPanel id="pnlSearchResults" style="margin:10px;overflow-Y:auto;" layout="block"> <apex:pageBlock id="searchResults" title="Port of Origin" mode="edit" tabStyle="Sourcing__tab"> <apex:pageBlockButtons location="top" style="padding-left:70px;"> <apex:commandButton action="{!URLFOR($Action.Port_of_Origin__c.New)}" value="New Port of Origin" id="blockUI" style="font-weight:bold;width:120px;" /> </apex:pageBlockButtons> <apex:pageBlockTable value="{!results}" var="a" id="tblResults"> <apex:column > <apex:facet name="header"> <apex:outputPanel >Action</apex:outputPanel> </apex:facet> <apex:outputLink title="Edit" value="/{!a.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-size:12px; color: #015BA7;font-weight: normal;text-decoration: none;">Edit</apex:outputLink> | <apex:commandLink id="idToDel" reRender="searchResults" title="Delete" action="{!deleteMethod}" immediate="true" onclick="if(!confirm('Are you sure you want to delete ?')) return false;" oncomplete="writeDB();" style="font-size:12px;color: #015BA7;font-weight: normal;text-decoration: none;">Del <apex:param value="{!a.Id}" name="idToDel" assignTo="{!delId}"/> </apex:commandLink> </apex:column> <apex:column > <apex:facet name="header"> <apex:outputPanel style="">Port of Origin Name</apex:outputPanel> </apex:facet> <apex:outputLink value="/{!a.id}" id="eventlink" >{!a.Name} </apex:outputLink> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:outputPanel> </apex:actionRegion> </apex:form> </body> </apex:page>
1. As for Search I have a input text box with a command Button "Go!" i.e search Button the problem here is when is Enter the search text and Press Enter key in my KeyBoard the Go button is not invoked , instead the New Button of below of PageBlock is being Invoked.
It works very fine when enter search text and Manually inovkes "Go!" Button or using Mouse or Tab and Enter key.
So I want Only "Go!" Button to be invoked after entering searchtext by Pressing Enter key.
2. In PageblockTable the 1st column has Edit and Delete command links. When I click the DEL command link the Entire page is being refreshes or reloaded with record being deleted... I want only a certain portion or a Output Panel or PageBlockTable to only RELOAD or REFRESHED, leaving the entire page remain Constant only certain page to be reloaded similar to inbox of gmail ... Intially I used Rendered but failed to get the required scenario.
-Thank you
Hi,
Regarding #2
I wonder if that not lies in the nature of commandLink?
Try using outputText, format it as a link and add an actionSupport tag for the action and rerender part.
HTH / Niklas
Hi,
I didn't get u ,
the code for DEL is
<Script>
function writeDB()
{
location.reload( 0 );
return false;
}
</Script>
.
.
.
<apex:commandLink id="idToDel" reRender="tblResults" title="Delete" action="{!deleteMethod}" immediate="true" onclick="if(!confirm('Are you sure you want to delete ?')) return false;" oncomplete="writeDB();" >Del
<apex:param value="{!a.Id}" name="idToDel" assignTo="{!delId}"/>
</apex:commandLink>
Then how to Use apex:inputtext without apex:param.......... Please provide a sample code
Hi,
So this is a suggestion to question #2. You can use actionsupport to update only certain sections on a page.
In this case I have used a boolean (booleanVal) instead if delId just to test with the rerendering.
This code assumes booleanVal is set to false in the constructor. When clicking on 'A link' the outputPanel below becomes visible and then invisible again when clicking on the link again.
// Niklas
When I click "A Link" the record is being deleted but it still present on page,, when i refresh the entire page it is removed,, So the reRender within the Output-Panel didn't work well ........ Please suggest some other Way! :)
It works for me so it depends on the context it is put in.
Can you post your code after the change? You have to rerender the right outputpanel of course.
As with your code I had Modified my Code: Before to that Please check my Previous VF Code
And My Controller for Old Code is (which may help you to set aMethod and BooleanVlaue in VF newCode)
And My Modified Code with your Post is as Follows
Please Correct this Code Such that When I click DEL only pageBlock reRenders and Delets the record .... or Suggest me some other code to Delete the record and Stay within the samePage
Hi,
This is not working because you are using the value of {!a.id} as a boolean value.
Create another property in your controller, for example
Then set this to true in 'deleteMethod'
Or use another param for this.
Change the rendered attribute to the value of 'displayArea'
Now when the outputpanel is rerendered it will display what's inside since 'displayArea' is true. Well, hopefully unless there is something else not working.
// Niklas