• bolaurent.ax1262
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies

I'm trying to set a database field to null from a javascript remote.

 

{!REQUIRESCRIPT('/soap/ajax/22.0/connection.js')}
{!REQUIRESCRIPT('/soap/ajax/22.0/apex.js')}
var __sfdcSessionId = '{!GETSESSIONID()}';

updater= new sforce.SObject("Account");

updater.id='{!Account.Id}';
updater.Stage_Expiry_Date__c = "";

resultC = sforce.connection.update([updater]);

 Above does not work.

 

The API documentation for update says "add the field name to the fieldsToNull array in the sObject." But I can't seem to figure out how to to that from javascript:

 

updater.fieldstoNull.push("Stage_Expiry_Date__c");

 Produces the message "updater.fieldsToNull undefined."

 

How can I set a field to null from javascript remotey?

 

 

I have a bit of markup that displays a pulldown menu for an apex variable, and the field is required.

 

The markup looks like this:

 

                       <apex:pageBlockSectionItem >
                           <apex:outputLabel value="Select Territory" for="territory"/>
                           <apex:outputPanel layout="block" styleClass="requiredInput">
                               <apex:outputPanel layout="block" styleClass="requiredBlock"/>
                               <apex:actionRegion>
                               <apex:selectList value="{!theTerritoryUtility.territoryId}" 
                                                id="territory" 
                                                size="1"
                                                required="True">
                                   <apex:selectOptions value="{!theTerritoryUtility.territoryOptions}"/>
                                   <apex:actionSupport event="onchange" 
                                                       rerender="leadDelegation"/>
                               </apex:selectList>
                               </apex:actionRegion>
                           </apex:outputPanel>
                       </apex:pageBlockSectionItem>

 

 

And when the user tries to save without entering a value, the error message looks like this:

 

thePage:theForm:thePageBlock:leadDelegation:j_id368:territory: Validation Error: Value is required.

 

Is there something I can do to make the error message less ugly?

 

 

I have a VF page that contains an inputfield tag for a picklist. The picklist is defined so that one of the values is the default value.

 

If I create the record in apex, and display it with VF, the field shows up with the default value already set. The documentation states "Beginning with API version 20.0, an inputField matched to a field with a default value has the default value prepopulated on the Visualforce page."

 

However, I want to set the field to Null in apex, and not have any default. 

How can I accomplish this? I tried setting the version to 19, and that worked, but it seems a bit fragile. Do I need to add some js to change the default value in the VF page?

 

Hi all,

 

        Can anyone help me in using Checkbox in visualfoce, am new to visualforce,

I have three checkbox, The value selecting in a checkbox should be stored in a custom object and whenever i open the page again.. the selected value should retrive from the custom object and display the checkbox selected.

 

I want to use the <apex:inputCheckbox tag..

 

Please give me some idea...

I have a bit of markup that displays a pulldown menu for an apex variable, and the field is required.

 

The markup looks like this:

 

                       <apex:pageBlockSectionItem >
                           <apex:outputLabel value="Select Territory" for="territory"/>
                           <apex:outputPanel layout="block" styleClass="requiredInput">
                               <apex:outputPanel layout="block" styleClass="requiredBlock"/>
                               <apex:actionRegion>
                               <apex:selectList value="{!theTerritoryUtility.territoryId}" 
                                                id="territory" 
                                                size="1"
                                                required="True">
                                   <apex:selectOptions value="{!theTerritoryUtility.territoryOptions}"/>
                                   <apex:actionSupport event="onchange" 
                                                       rerender="leadDelegation"/>
                               </apex:selectList>
                               </apex:actionRegion>
                           </apex:outputPanel>
                       </apex:pageBlockSectionItem>

 

 

And when the user tries to save without entering a value, the error message looks like this:

 

thePage:theForm:thePageBlock:leadDelegation:j_id368:territory: Validation Error: Value is required.

 

Is there something I can do to make the error message less ugly?

 

 

I have a VF page that contains an inputfield tag for a picklist. The picklist is defined so that one of the values is the default value.

 

If I create the record in apex, and display it with VF, the field shows up with the default value already set. The documentation states "Beginning with API version 20.0, an inputField matched to a field with a default value has the default value prepopulated on the Visualforce page."

 

However, I want to set the field to Null in apex, and not have any default. 

How can I accomplish this? I tried setting the version to 19, and that worked, but it seems a bit fragile. Do I need to add some js to change the default value in the VF page?