You need to sign in to do that
Don't have an account?
電話番号ハイフン抜きで検索
電話番号で顧客情報を検索する検索画面を作成しようとしています。
検索条件の電話項目を‐抜きの数字のみ、検索元の電話項目も‐抜きの数字のみで検索したいと考えています。
ロジックはどの様に作成するがよいのでしょうか?
教えて頂けませんでしょうか?
・S_tellno__cは電話項目です。
<apex:page action="{!init}" standardController="RssSearch__c" extensions="RSS_ListCon">
<apex:sectionHeader title="顧客情報検索"/>
<apex:pageMessages id="messagearea" showDetail="false" />
<apex:form >
<apex:outputPanel >
<apex:pageBlock title="顧客情報検索">
<apex:panelgrid id="searchPanel" columns="10">
<apex:outputLabel value="{!$ObjectType.customer_master__c.fields.name.label}:" for="hallname" />
<apex:inputField id="hallname" value="{!rss.S_hallname__c}"/>
<apex:outputLabel value="{!$ObjectType.costomer_master__c.fields.tel_number__c.label}:" for="tellno"/>
<apex:inputField id="tellno" value="{!rss.S_tellno__c}"/>
<apex:outputLabel value="{!$ObjectType.costomer_master__c.fields.address__c.label}:" for="address"/>
<apex:inputText id="address" value="{!rss.S_address__c}"/>
<apex:outputLabel value="{!$ObjectType.costomer_master__c.fields.hall_corp__c.label}:" for="hall_corp"/>
<apex:inputText id="hall_corp" value="{!rss.S_hall_corp__c}"/>
</apex:panelgrid>
<apex:commandButton value="検索" action="{!search}" />
<apex:commandButton value="クリア" action="{!clear}"/>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
<!--検索結果表示画面-->
検索条件の方はreplaceでハイフンを除外することが可能だと思いますが、
検索元の方を検索時のみハイフンを除外するのは難しいと思います。
入力規則で登録する値にハイフンが登録されないようにしてしまった方が良いかと思います。
数式項目でハイフン抜きの電話番号項目を作成しておき、その項目を検索するのは如何でしょうか?