• Anca Mosoiu
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi there,

I have a custom object, and created a Visualforce page to make it easy for people to add new records for this object.  After submitting the form, the user is taken to the page for that new object.  What I'd like to do is take them to a new, empty form so they can quickly and easily enter an additional record.  

I tried to use the "oncomplete" attribute on my command button, but it's not working.  What am I missing?

Thanks in advance! 

Here's the code:
 
<!-- Typeahead form plus saving / updating -->
<apex:page standardController="Book__c" showHeader="false" sidebar="False" title="Receive a Book">

   <script type="text/javascript">
   function reloadme(){
       window.location.href="https://c.na17.visual.force.com/apex/EBCBP_Receive_Books?sfdc.tabName=01ro0000000Wc30";
   }
   </script>
   
   <div class="messages"> 
    <apex:messages />
   </div>
   
    <apex:form target="_self">
    
    <div class="entry-form">
        <img src="http://eastbaychildrensbookproject.org/new/wp-content/uploads/2012/07/ebcbp_headergraphic.png"/>
        <h1>Welcome to the East Bay Children's Book Project</h1>
        <p>If you've received books from us before, please proceed below.  Otherwise, go <a href="http://www.eastbaychildrensbookproject.org/kiosk/new-client/">Here</a></p>
        <h3>Your Name:</h3>
        <c:Typeahead secondaryField="Email" placeholder="Enter name or email" minSearchLength="3"
            destinationForSelectedId="contactId"/> 

        <h3>Organization:</h3>
        <c:Typeahead searchBoxId="acctSearchBox" object="Account" primaryField="Name" secondaryField="BillingCity" 
                searchScope="NAME" placeholder="Enter organization name..." minSearchLength="3" 
                destinationForSelectedId="accountId" destinationForSelectedValue="accountName" stealFocus="false" />  

        <h3>Books Received</h3>
        <apex:inputField value="{!Book__c.Number_Received__c}"/>

        <h3>Date Received</h3>
        <apex:inputField value="{!Book__c.DateReceived__c}" />

        <apex:inputHidden value="{!Book__c.Organization__c}" id="accountId"/>
        <apex:inputHidden value="{!Book__c.Person__c}" id="contactId"/>

        
        <input type="hidden" name="accountName" id="accountName" />     

        <apex:commandButton action="{!save}" value="Save" oncomplete="reloadme()"/>


    </div>
    </apex:form>

</apex:page>

 
Hi there,

I have a custom object, and created a Visualforce page to make it easy for people to add new records for this object.  After submitting the form, the user is taken to the page for that new object.  What I'd like to do is take them to a new, empty form so they can quickly and easily enter an additional record.  

I tried to use the "oncomplete" attribute on my command button, but it's not working.  What am I missing?

Thanks in advance! 

Here's the code:
 
<!-- Typeahead form plus saving / updating -->
<apex:page standardController="Book__c" showHeader="false" sidebar="False" title="Receive a Book">

   <script type="text/javascript">
   function reloadme(){
       window.location.href="https://c.na17.visual.force.com/apex/EBCBP_Receive_Books?sfdc.tabName=01ro0000000Wc30";
   }
   </script>
   
   <div class="messages"> 
    <apex:messages />
   </div>
   
    <apex:form target="_self">
    
    <div class="entry-form">
        <img src="http://eastbaychildrensbookproject.org/new/wp-content/uploads/2012/07/ebcbp_headergraphic.png"/>
        <h1>Welcome to the East Bay Children's Book Project</h1>
        <p>If you've received books from us before, please proceed below.  Otherwise, go <a href="http://www.eastbaychildrensbookproject.org/kiosk/new-client/">Here</a></p>
        <h3>Your Name:</h3>
        <c:Typeahead secondaryField="Email" placeholder="Enter name or email" minSearchLength="3"
            destinationForSelectedId="contactId"/> 

        <h3>Organization:</h3>
        <c:Typeahead searchBoxId="acctSearchBox" object="Account" primaryField="Name" secondaryField="BillingCity" 
                searchScope="NAME" placeholder="Enter organization name..." minSearchLength="3" 
                destinationForSelectedId="accountId" destinationForSelectedValue="accountName" stealFocus="false" />  

        <h3>Books Received</h3>
        <apex:inputField value="{!Book__c.Number_Received__c}"/>

        <h3>Date Received</h3>
        <apex:inputField value="{!Book__c.DateReceived__c}" />

        <apex:inputHidden value="{!Book__c.Organization__c}" id="accountId"/>
        <apex:inputHidden value="{!Book__c.Person__c}" id="contactId"/>

        
        <input type="hidden" name="accountName" id="accountName" />     

        <apex:commandButton action="{!save}" value="Save" oncomplete="reloadme()"/>


    </div>
    </apex:form>

</apex:page>