function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Visualforce field not passing to controller

I have a visualforce page that is populated with data froma record.

I want to enable the user to view the field, update it and save.

This is the VF:

        <apex:repeat value="{!Config}" var="uD">
            Users will be automatically deactivated <strong><apex:outputText value="{!uD.Deactivate_After__c}"/></strong> days after the last login.<br/>
            Set a new value in days&nbsp; <apex:inputText id="origDays" value="{!uD.Deactivate_After__c}" style="width:27px;"/>&nbsp;&nbsp;
            <apex:commandButton value="Set" action="{!adduserDays}">
                <apex:param id="chgDays" name="newParam" value="{!uD.Deactivate_After__c}" assignTo="{!newDays}"/>

 The controller:

    public Decimal newDays {get;set;}    
    public PageReference addUserDays() {
        List<V100_Control__c> userRec = [SELECT Id, Frequency__c, Deactivate_After__c, Time__c FROM V100_Control__c WHERE Id = 'a01d00000077Ayi' LIMIT 1];     
        system.debug('JMM newDays: ' + newDays);
        //userRec[0].Deactivate_After__c = newDays;
        try {
          update userRec;
        } catch (DMLException e) {
          ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Days could not be changed.'));
          return null;
        //ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Rule Created'));
         return null;    

The newdays field is always null.

Can anyone help with how i can allow the user to upadte this field and pass it to the controller. I cannot use a custom controller.


Since the winter 10 release, I've found that parameters aren't passed unless you make an Ajax request, i.e. provide a rerender attribute on the command button.  If I don't have anything to sensibly rerender, I add an outputpanel around the entire page content and rerender that.