Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7414795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:10:18+00:00 2026-05-29T07:10:18+00:00

I have a Vf page which shows a list in a apex:repeat tag. All

  • 0

I have a Vf page which shows a list in a apex:repeat tag. All the fields displayed are apex:inputfield. There are 2 fields

  1. quantity__c
  2. Change__c

I want to validate, if the quantity has changed then i want the change field should
be filled/mandatory. Can i do this validation at VF level?

Any other way of accomplishing this?

Thanks

Update: Here is code i am using as suggested by LaceySnr. I can see the apex message is thrown in the debug log but its not visible in Vfpage

     for (integer i=0;i<List_FinalStdItems.size();i++)
    {
        system.debug('inside loop to check quantity is changed');
        ItemSet.add(List_FinalStdItems[i].id);
        system.debug('New quantity'+List_FinalStdItems[i].quantity__c +'  old quantity'+MapStdItemsOldMap.get(List_FinalStdItems[i].id).quantity__c);
     //   system.debug('old quantity'+MapStdItemsOldMap.get(List_FinalStdItems[i].id).quantity__c);
        if (MapStdItemsOldMap.get(List_FinalStdItems[i].id).quantity__c!=List_FinalStdItems[i].quantity__c)
        {
            system.debug('This quantity for item '+List_FinalStdItems[i].Name+ ' has changed');
            if(List_FinalStdItems[i].Inventory_Change_Reason__c==null || List_FinalStdItems[i].Inventory_Change_Reason__c=='')
            {
                system.debug('This quantity for item '+List_FinalStdItems[i].Name+ ' has changed and Reason for change is empty');
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Reason for change not entered for changed Quantity'));
                error=true;
            }
        }
    }


01:04:55.541 (541902000)|SYSTEM_METHOD_ENTRY|[151]|ApexPages.addMessage(ApexPages.Message)
01:04:55.541 (541985000)|VF_PAGE_MESSAGE|Reason for change not entered for changed Quantity
01:04:55.542 (542008000)|SYSTEM_METHOD_EXIT|[151]|ApexPages.addMessage(ApexPages.Message)

Edit

 <apex:outputpanel id="mess">
<apex:pageMessages />
</apex:outputpanel>
.
.
.
 <apex:actionFunction name="save" action="{!Save}" rerender="mess"/>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:10:18+00:00Added an answer on May 29, 2026 at 7:10 am

    You could do this through javascript directly, or you could use <apex:actionSupport> with the onChange event to refresh the second field, but to be honest I think the simplest and most robust way would be to just do the validation in the controller before saving a record.

    Edit

    I assume you have an <apex:pageMessages/> tag in the page, make sure you’re rerendering it — i.e. if you’re not doing a whole page refresh, put the messages tag in an output panel and specify that <apex:outputPanel> in the rerender attribute for your action.

    Edit II

    Is your action definitely returning a null Pagereference? Otherwise what you have looks correct. Are there any page blocks etc. between your action function and the output panel? If so you may need to drill down through an id hierarchy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have page there is button which shows iframe where is small list with
I have a page called list.php which retrieves from database and shows all the
Hi I have a page in my java/jsp based web application which shows list
I have an index page which shows a paged list of data from a
At current i have an index page which shows values from an XML page
I have a web page with a read-only text box which shows some HTML
I'm generating a page using jsp, it has a list element which shows a
I have a list of TV shows which is about 200 shows long. Each
We have an asp.NET page which is programmaticaly adding data as new list items
I have a JSP page which shows items included in an Array (Just a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.