0

    <apex:pageBlock title="Find Duplicates">
    <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="Save"/>
        </apex:pageBlockButtons>



        <apex:pageBlockSection columns="1" collapsible="false" showHeader="true">


            <apex:pageBlockSectionItem >
             <apex:outputLabel for="scenarioObj" value="Select Object" />
                <apex:outputPanel styleClass="requiredInput" layout="block">
                    <apex:outputPanel styleClass="requiredBlock" layout="block" />
                    <apex:selectList id="scenarioObj" size="1" required="true" value="{!selectedObject}" multiselect="false">
                        <apex:selectOptions value="{!ObjectNames}" />
                        <apex:actionStatus layout="block" id="objStatus" startText="Updating Object fields..." />
                        <apex:actionSupport event="onchange" rerender="objField" status="objStatus" />
                    </apex:selectList>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>

        </apex:pageBlockSection>
        <apex:pageBlockSection columns="2" collapsible="false" showHeader="true">

            <apex:pageBlockSectionItem >
                <apex:outputLabel for="objField" value="Select Field" />
                <apex:outputPanel styleClass="requiredInput" layout="block" id="fieldPanel">
                    <apex:outputPanel styleClass="requiredBlock" layout="block" />
                    <apex:selectList id="objField" required="true" value="{!selectedField}" multiselect="false" size="1">
                        <apex:selectOptions value="{!ObjectFields}" />
                        <apex:actionStatus layout="block" id="fieldStatus" startText="Updating Object fields..." />
                        <apex:actionSupport event="onchange" rerender="fieldvalue1" status="fieldStatus" />
                    </apex:selectList>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>

            <apex:pageBlockSectionItem >
         <apex:outputLabel for="scenarioObj" value="Field Value" />
                <apex:outputPanel styleClass="requiredInput" layout="block">
                    <apex:outputPanel styleClass="requiredBlock" layout="block" />
                    <apex:inputText id="fieldvalue1" value="{!selectedFieldValue}" />
                </apex:outputPanel>
            </apex:pageBlockSectionItem>

        </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:pagemessages ></apex:pagemessages>
</apex:form>

  • I am dynamically getting object and fields whenever user select a field and i have one input text where i enter data and search if i enter wrong data i shouldnt want to go for class – ravi Mar 2 '16 at 15:45
  • experienced guys plz tell procedure i mean where to start overview – ravi Mar 2 '16 at 16:14
  • Not sure what you mean by "wrong data" you input is set to the value of what was selected. Why do they need to change it? Regardless, quickest way is to handle it in the controller. If value is not correct then simply add a page message and return or return null – Eric Mar 2 '16 at 17:53
  • select object:Account select field :AccountName filed value:1234 like this is wrong – ravi Mar 3 '16 at 10:52
  • But the options they can pick are populated by you / your controller. How about only showing them correct values??? This should be done before presenting them with choices not after the fact. Since the Input text is based on the selected value from the previous pick list why even have the input text, simply use the select list since you do not want them to enter anything but what is in the select list. Confused by why you have the additional field if they should not enter anything but the available select values – Eric Mar 3 '16 at 12:55
0

If I get your question correctly,

on vf page when you specify any field as numeric field, and user enter something like this, '118ab' how you can show the error mesage.

In cases like this, you can use isnan() method to check whether entered value is numeric or not.

Likewise you will have many conditions to check whether the datatype and data you enter matches or not.

You can use the try catch when anything fails and show a custom message on the vf page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.