• bunrotha
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies

I have a particular oddity in a VF page.

 

I'm trying to show or hide fields based on picklists, so if the user picks a certain option, they get prompted for more detail, or if they pick anything off a multi-select picklist, they get asked for detail.

 

This works fine for a single option picklist, but not on a multi-select picklist.

When I change the multi-select picklist, there's no indication of any activity, the status message doesn't change, and no refresh.  I'm using IE8.

 

With the single-option picklist, I found I had to use an outputpanel to get the rerender to work, if I put the rerender into the pageblocksectionitem itself, it never behaved.

 

Here's some code, no controller just a custom object, can anyone see if I've cocked this up or not please?

 

<apex:inputfield value="{!object__c.themultiselectpicklist__c}"> <apex:actionsupport event="onchange" rerender="esref" status="stat"/> </apex:inputfield> <apex:outputPanel id="esref"> <apex:pageblocksectionItem rendered="{!TICK__c.object__c.themultiselectpicklist__c!=''}"> <apex:outputLabel value="Have you been provided with any reference numbers?"/> <apex:inputField value="{!object__c.Ref_Numbers__c}"/> </apex:pageblocksectionItem> </apex:outputPanel> <apex:inputfield value="{!Object__C.singleoptionpicklist__c}"> <apex:actionsupport event="onchange" rerender="witlist" status="stat"/> </apex:inputfield> <apex:outputPanel id="witlist"> <apex:pageblocksectionItem rendered="{!Object__C.singleoptionpicklist__c='Yes'}" > <apex:outputlabel value="Please list the names"/> <apex:inputtextarea cols="120" rows="5" value="{!Tick__c.namelist__c}"/> </apex:pageblocksectionitem> </apex:outputpanel> <apex:actionstatus id="witstat" starttext="Working" stoptext="Ready"> </apex:actionstatus>

 

Hi-

 

I'm struggling with the best way to approach something in Visualforce, any thought appreciated.

 

Our postroom folk would like a nice simple UI for logging the outgoing post. 

Each post item they log is a detail custom object belonging to an opportunity.

I have no problem creating a VF page for doing one item at a time.

 

What I'm struggling with is creating a page that allows them to set two or three common fields, enter up to ten rows of data and push the button to have ten almost-identical items created and associated with the appropriate opportunities.   Ten is a number that's "comfortable" on screen for them, in case anyone says "Why ten?" 

 

Since I'm dealing with multiple items and multiple "parent" opportunities, I can't use most of the pre-defined apex form components, which all tie back to one ID.

 

Right now, I'm exploring the idea of having HTML form items, and building the items in javascript to insert via API calls.  This is causing me problems with permission denied errors on picklist values, trying to work out indirect references to form elements rather than hardcode each item in the form, and a plague of other things.

 

Has anyone run into this type of idea before, and have any insight they can share on how to approach it please?

 

My first "evil half-breed" page of code looks like this, and it doesn't even approach working, but may give an idea of what I was thinking:

 

<apex:page standardcontroller="Disbursement__c"> <head> <link href="/sCSS/Theme2/en/common.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="/js/functions.js"></script> <script src="/soap/ajax/12.0/connection.js"></script> <script type="text/javascript"> function PostThePost(form) { // Build an array of disbursements for the post items. var PostItem = new sforce.SObject("Disbursement__c"); var PostPile = new Array(PostItem); // Build an array of Tasks to enter completed tasks for return of docs var PostLog = new sforce.Sobject("Task"); var LogPile = new Array(PostLog); // Create a holder for the query returned records var Record = new Array(); // Create the basic query string var Querystub = "Select Id from Opportunity Where Claim_ref__c = " // Cycle through the inputs for (var x = 0; x < 10; x++) {

// TODO: check that the form field has data before triyng to query, we might only need to do 1 query of the ten.. // Find the relevant opportunityId by querying for it- this needs to be indirect, so if x=0 query T1, x=1 query T2 etc var saveResult = sforce.connection.query(Querystub+eval(form.+'T'+x+1+'.value')); // If it returned a record, it will be one- Claim_ref__c is a unique field if (saveResult.size != 0){ // grab the record Record = saveResult.records; //Put the opportunity ID into the new disbursement record. PostPile[x].Disbursements__c = Record.Id; //Fill in the postage type picklist field PostPile[x].Postage_type__c = form.Type_of_post.value; //The record type ID is constant for postage disbursements PostPile[x].RecordTypeId = '012200000004w5OAAQ'; //Set the field of the label, in theory only if postage type is registered or special delivery PostPile[x].Post_tracking__c = eval(form.+'T'+x+11+'.value');

// TODO: place an "OK" next to the relevant item, clear the field entry to prevent duplication,

// and if the checkbox is ticked, create a Task on the opportunity, subject "Docs returned" that is complete. } } //Shovel with an update var didTheUpdateWork = sforce.create(PostPile); // Do any cleanup and error catching we need to, TODO

// TODO Wait for use to do their thing, then //Get back to the Leads tab that this user invariably lives on //window.parent.location.href="{! urlFor( $Action.Lead.Tab , $ObjectType.Lead,null,true)}"; } </script> </head> This is the Outgoing post form<br></br> Designed to enter disbursements for outgoing post, and log a completed task for document returns. <br></br> <br></br> <form name="PostForm" method="POST" action="" class="dataCol"> <select name="Type_of_post" size="1" class="requiredBlock"> <option value="First class">First class</option> <option value="Second class">Second class</option> <option value="Registered">First class, Registered Signed for</option> <option value="Second class, Registered Signed for">Second class, Registered Signed For</option> <option value="Special Delivery next day">Special Delivery next day</option> <option value="Special Delivery before 9am">Special Delivery before 9am</option> </select> Tick here if these are doc returns <input type="checkbox" name="C1" value="ON"/><br></br> <table cols="2"> <tr><td>Case number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td> <td>Label number for Registered/SD</td></tr> <tr class="dataCol col02"><td><input type="text" name="T1" size="6"/></td><td><input type="text" name="T11" size="10"/></td></tr> <tr><td><input type="text" name="T2" size="6"/></td><td><input type="text" name="T12" size="10"/></td></tr> <tr><td><input type="text" name="T3" size="6"/></td><td><input type="text" name="T13" size="10"/></td></tr> <tr><td><input type="text" name="T4" size="6"/></td><td><input type="text" name="T14" size="10"/></td></tr> <tr><td><input type="text" name="T5" size="6"/></td><td><input type="text" name="T15" size="10"/></td></tr> <tr><td><input type="text" name="T6" size="6"/></td><td><input type="text" name="T16" size="10"/></td></tr> <tr><td><input type="text" name="T7" size="6"/></td><td><input type="text" name="T17" size="10"/></td></tr> <tr><td><input type="text" name="T8" size="6"/></td><td><input type="text" name="T18" size="10"/></td></tr> <tr><td><input type="text" name="T9" size="6"/></td><td><input type="text" name="T19" size="10"/></td></tr> <tr><td><input type="text" name="T10" size="6"/></td><td><input type="text" name="T20" size="10"/></td></tr></table> <p>&nbsp;</p> <input type="button" value="Submit Post" onclick="PostThePost(this.form)" name="B1" class="btn"/><input type="reset" value="Reset" name="B2" class="btn"/> </form></apex:page>

 

Thanks,

Nick

Message Edited by bunrotha on 01-21-2009 06:52 AM

I have a particular oddity in a VF page.

 

I'm trying to show or hide fields based on picklists, so if the user picks a certain option, they get prompted for more detail, or if they pick anything off a multi-select picklist, they get asked for detail.

 

This works fine for a single option picklist, but not on a multi-select picklist.

When I change the multi-select picklist, there's no indication of any activity, the status message doesn't change, and no refresh.  I'm using IE8.

 

With the single-option picklist, I found I had to use an outputpanel to get the rerender to work, if I put the rerender into the pageblocksectionitem itself, it never behaved.

 

Here's some code, no controller just a custom object, can anyone see if I've cocked this up or not please?

 

<apex:inputfield value="{!object__c.themultiselectpicklist__c}"> <apex:actionsupport event="onchange" rerender="esref" status="stat"/> </apex:inputfield> <apex:outputPanel id="esref"> <apex:pageblocksectionItem rendered="{!TICK__c.object__c.themultiselectpicklist__c!=''}"> <apex:outputLabel value="Have you been provided with any reference numbers?"/> <apex:inputField value="{!object__c.Ref_Numbers__c}"/> </apex:pageblocksectionItem> </apex:outputPanel> <apex:inputfield value="{!Object__C.singleoptionpicklist__c}"> <apex:actionsupport event="onchange" rerender="witlist" status="stat"/> </apex:inputfield> <apex:outputPanel id="witlist"> <apex:pageblocksectionItem rendered="{!Object__C.singleoptionpicklist__c='Yes'}" > <apex:outputlabel value="Please list the names"/> <apex:inputtextarea cols="120" rows="5" value="{!Tick__c.namelist__c}"/> </apex:pageblocksectionitem> </apex:outputpanel> <apex:actionstatus id="witstat" starttext="Working" stoptext="Ready"> </apex:actionstatus>

 

How do you control the format for a VisualForce page that renderes as a PDF in A4 format

Hey everyone, I've run into something that I'm a bit perplex on.

 

I have a 3 page wizard. Page 1. (SalesPAWizard1) Contains some inputText boxes that populate a get/set methods in my Extension.

 

Page 2. (SalesPAWizard2)Is a "Preview" of page 3 using apex : include.

 

My issue is when a user fills out the inputtext boxes on page and clicks my command button to go to the next page I get an error:

"System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Opportunity.CloseDate"

 

I'm confused since if I load Page 2 separately (without going through page 1) it loads perfectly fine.  All my pages have the same standardcontroller and using the same extension. I've tried just copying the code from Page 3 directly to Page 2 instead of using the Apex : include option - but I get the same result.

 

PageReference Code in Controller Extension:

public PageReference NextStep2()
{
return page.SalesPAWizard2;
}

 

 

Code in Page 2

<apex:page StandardController="Opportunity" extensions="OpportunityPAWizardExtension">
<apex:include pageName="SalesPAPDF" />
</apex:page>

 

Code in Page 3 that's in the error

 

<apex:page standardcontroller="Opportunity" extensions="OpportunityPAWizardExtension" > 

<apex:outputlabel value="Purchase Proposal Date: " style="font-weight:bold"/ >
<apex:outputfield value="{!Opportunity.CloseDate}" /> <br/>

I've tried commenting this out - but it appears anytime in Page 3 where I'm calling the Opportunity fields (standard Controller being used).

 

I've tried creating a new PageReference, setting the redirect to true and putting the OpportunityID as a parameter - but this didn't carry over the input fields from Page1. Anyone have any suggestions or recommendations of where to look?

Hi-

 

I'm struggling with the best way to approach something in Visualforce, any thought appreciated.

 

Our postroom folk would like a nice simple UI for logging the outgoing post. 

Each post item they log is a detail custom object belonging to an opportunity.

I have no problem creating a VF page for doing one item at a time.

 

What I'm struggling with is creating a page that allows them to set two or three common fields, enter up to ten rows of data and push the button to have ten almost-identical items created and associated with the appropriate opportunities.   Ten is a number that's "comfortable" on screen for them, in case anyone says "Why ten?" 

 

Since I'm dealing with multiple items and multiple "parent" opportunities, I can't use most of the pre-defined apex form components, which all tie back to one ID.

 

Right now, I'm exploring the idea of having HTML form items, and building the items in javascript to insert via API calls.  This is causing me problems with permission denied errors on picklist values, trying to work out indirect references to form elements rather than hardcode each item in the form, and a plague of other things.

 

Has anyone run into this type of idea before, and have any insight they can share on how to approach it please?

 

My first "evil half-breed" page of code looks like this, and it doesn't even approach working, but may give an idea of what I was thinking:

 

<apex:page standardcontroller="Disbursement__c"> <head> <link href="/sCSS/Theme2/en/common.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="/js/functions.js"></script> <script src="/soap/ajax/12.0/connection.js"></script> <script type="text/javascript"> function PostThePost(form) { // Build an array of disbursements for the post items. var PostItem = new sforce.SObject("Disbursement__c"); var PostPile = new Array(PostItem); // Build an array of Tasks to enter completed tasks for return of docs var PostLog = new sforce.Sobject("Task"); var LogPile = new Array(PostLog); // Create a holder for the query returned records var Record = new Array(); // Create the basic query string var Querystub = "Select Id from Opportunity Where Claim_ref__c = " // Cycle through the inputs for (var x = 0; x < 10; x++) {

// TODO: check that the form field has data before triyng to query, we might only need to do 1 query of the ten.. // Find the relevant opportunityId by querying for it- this needs to be indirect, so if x=0 query T1, x=1 query T2 etc var saveResult = sforce.connection.query(Querystub+eval(form.+'T'+x+1+'.value')); // If it returned a record, it will be one- Claim_ref__c is a unique field if (saveResult.size != 0){ // grab the record Record = saveResult.records; //Put the opportunity ID into the new disbursement record. PostPile[x].Disbursements__c = Record.Id; //Fill in the postage type picklist field PostPile[x].Postage_type__c = form.Type_of_post.value; //The record type ID is constant for postage disbursements PostPile[x].RecordTypeId = '012200000004w5OAAQ'; //Set the field of the label, in theory only if postage type is registered or special delivery PostPile[x].Post_tracking__c = eval(form.+'T'+x+11+'.value');

// TODO: place an "OK" next to the relevant item, clear the field entry to prevent duplication,

// and if the checkbox is ticked, create a Task on the opportunity, subject "Docs returned" that is complete. } } //Shovel with an update var didTheUpdateWork = sforce.create(PostPile); // Do any cleanup and error catching we need to, TODO

// TODO Wait for use to do their thing, then //Get back to the Leads tab that this user invariably lives on //window.parent.location.href="{! urlFor( $Action.Lead.Tab , $ObjectType.Lead,null,true)}"; } </script> </head> This is the Outgoing post form<br></br> Designed to enter disbursements for outgoing post, and log a completed task for document returns. <br></br> <br></br> <form name="PostForm" method="POST" action="" class="dataCol"> <select name="Type_of_post" size="1" class="requiredBlock"> <option value="First class">First class</option> <option value="Second class">Second class</option> <option value="Registered">First class, Registered Signed for</option> <option value="Second class, Registered Signed for">Second class, Registered Signed For</option> <option value="Special Delivery next day">Special Delivery next day</option> <option value="Special Delivery before 9am">Special Delivery before 9am</option> </select> Tick here if these are doc returns <input type="checkbox" name="C1" value="ON"/><br></br> <table cols="2"> <tr><td>Case number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td> <td>Label number for Registered/SD</td></tr> <tr class="dataCol col02"><td><input type="text" name="T1" size="6"/></td><td><input type="text" name="T11" size="10"/></td></tr> <tr><td><input type="text" name="T2" size="6"/></td><td><input type="text" name="T12" size="10"/></td></tr> <tr><td><input type="text" name="T3" size="6"/></td><td><input type="text" name="T13" size="10"/></td></tr> <tr><td><input type="text" name="T4" size="6"/></td><td><input type="text" name="T14" size="10"/></td></tr> <tr><td><input type="text" name="T5" size="6"/></td><td><input type="text" name="T15" size="10"/></td></tr> <tr><td><input type="text" name="T6" size="6"/></td><td><input type="text" name="T16" size="10"/></td></tr> <tr><td><input type="text" name="T7" size="6"/></td><td><input type="text" name="T17" size="10"/></td></tr> <tr><td><input type="text" name="T8" size="6"/></td><td><input type="text" name="T18" size="10"/></td></tr> <tr><td><input type="text" name="T9" size="6"/></td><td><input type="text" name="T19" size="10"/></td></tr> <tr><td><input type="text" name="T10" size="6"/></td><td><input type="text" name="T20" size="10"/></td></tr></table> <p>&nbsp;</p> <input type="button" value="Submit Post" onclick="PostThePost(this.form)" name="B1" class="btn"/><input type="reset" value="Reset" name="B2" class="btn"/> </form></apex:page>

 

Thanks,

Nick

Message Edited by bunrotha on 01-21-2009 06:52 AM
When creating a query with Table Query Wizard, how are you able to create a "AND" or a "OR" statement in between the clauses?