Select only one type of field using JavaScript in Acrobat X

Looking for a way to select all fields of the same type on a form at once?
Such as selecting all text fields to modify the font type, or all buttons to modify display values. Prior versions 6,7, & 8 were able to do this. Would prefer a script for each control type however I do not see any information in the JavaScript Reference Guide about this.

The is no UI for selecting field by type in the newer versions of Acrobat.
Have you looked at the numFields property and example?
With some modification:
function FindFieldType(cType)
var aFieldNames = new Array(); // array of fields of type sFieldType
// walk the array of field names;
for ( var i = 0; i < this.numFields; i++) {
  var fname = this.getNthFieldName(i); 
  if ( fname.type = cType ) {
  // match to field type - add to array of names;
  aFieldNames[aFieldNames.length] = fname;
  } // end walk array of field names
return aFieldNames;
} // end FindFieldType function
var aMyFields = new Array();
// find button field type
aMyFields = FindFieldType("button");
// now do something with the array of field names;
app.alert("button fields: \n" +  aMyFields.join("\n");

Similar Messages

  • Get location/coordinates for a field using JavaScript in Acrobat Professional

    Good day,
    I am looking for a way to get the coordinates of a text field.
    I would like to create a listbox and set the location of the listbox top left to the text fields bottom left coordinates, I have had a look at the scripting guides ... could not turn up anything.
    I know how to create and populate this listbox using the JavaScript code, only problem is, to get the coordinates of the text box.

    Try this:
    1. Move or change the dimensions of the text boxes on the extracted page in the configuration that you want.
    2. When you are satisfied with the new configuration, modify the following JavaScript to use the names of the text boxes that you want to include on the page.
    //find_rect //find coordinates of text boxes whose names are included in the var rct,ary = ["fld_1","fld_2","fld_3","fld_4"]; //...etc.
    for (j = 0; j<ary.length; j++){
    console.println(ary[j]);
    rct = this.getField(ary[j]).rect;
    for (i= 0; i< rct.length; i++) console.println(rct[i]);
    3. Add the modified code to the document level of form. (as a doc level javascript but with no function name or brackets included.
    4. When you run the code, the coordinates for the fields that you have included in the array will be printed in the console window:
    Example:
    fld_1
    21
    777
    296
    717
    fld_2
    30
    769
    65
    729

  • Adding current date to text field w/ Javascript in Acrobat 8

    I am trying to add the current date to a text field using javascript in Acrobat 8 Professional. I am using the util.printd function in a javascript function but the date of creation shows in the text field, NOT today's date. Any clues??
    var f = this.getField("myField");
    if (!f.value) f.value = util.printd ("m/d/yyyy", new Date());

    Thanks. I've used it also without the empty value check and had the same result of showing the creation date and not the current date.

  • Declare the internal table with only one 10 character  field and use

    Hi,
    I want to declare the internal table with only one 10 character  field and use.
    Jaya

    Hi,
    Go ahead. U can declare IT with only one field
    Example:
    data: begin of zcustlist occurs 1000,
                   custmer(10)  type c,
             end of zcustlist.
    Narendra Reddy.
    Edited by: Narendra Reddy C on Aug 8, 2008 11:39 AM

  • Selecting only one row at a time

    Hi experts,
    i have following doubt regarding selecting rows from a db:
    Is there any way of selecting only one row AT A TIME from a dabase just to collect the data in rows instead of in a unique document containing all the rows?
    I would like you to ellaborate on this as i need to send only one row to the IE, and then other row, and so on... without throwing any error!
    I have seen that there are SELECT SINGLE and SELECT UP TO 1 ROW, but these two methods are only useful when retrieving only one row, and that does not match my requirements. I need to process all the rows but one by one..
    I know that we can use the receiver jdbc adapter as if it was a sender by means of its specific datatype, but how to do it row by row??
    Hope i had explained well..
    Thanks in advance and best regards,
    David

    Hi kiran,
    Yes, my table has 5 not null fields but i am selecting and updating fixes values so i think that I will definetely go for the next solution:
    SELECT * FROM t1 WHERE status='0' and ROWNUM<2;
    UPDATE t1 SET status='1' WHERE status='0' and ROWNUM<2;
    My only concern is if the update will take the same row that the select.... BTW, I think it will
    ..What do you guys think?
    I ve been trying to operate with your proposed queries but i received some errors. Your queries are very interesting but i think that with the above ones i meet my requirements as the status field will be 0 for not processed rows and 1 for precessed ones (and the update will look for the row that meets the same 'where' clause than the select, and then, and only then, it will set status='1').
    The only thing i have to care about is what i questioned before.
    Thanks a lot and best regards,
    David

  • How to select only one record at a time in ALV

    Hi all,
    I have to use ALV report.  Each record on the report output should have a button (or radio button) which will allow the record to be selected.  My requirement is to select only one record at a time.
    please guide me how to proceed further.
    regards
    manish

    hi
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/sampleCheckBoxProgram
    Regards
    Pavan

  • "Can I select only one page from a PDF document to convert to an excel doc. ?"

    "Can I select only one page from a PDF document to convert to an excel doc. ?"

    No, so extract one page, then convert.

  • How do you lock the ipad so only one app can be used

    I want to force a student to communicate using an ipad communication app.  I want the only thing on the screen to be that one app.  How do I lock the app so it is the only one that can be used on the ipad?   Is there a way to lock a page?  ie when he has navigated to the correct page to prevent the child from exiting and make him make a choice from that page?
    Thanks!

    You can lock an iPad to a given app via Guided Access:
    http://support.apple.com/kb/HT5509
    To try and lock a web browser to a single page you'll need to investigate third-party browsers such as MobiCIP or the McGruff browser and see if they allow you to lock to a single page. Safari in iOS 6 or earlier has no controls and in iOS 7 allows you to restrict to a given site or set of sites but not to a single web page.
    Regards.

  • Select only one entry - Message no. F5A156

    Dear Sir,
    Client require deleting multiple entries from petty cash book (FBCJ)
    When we are selecting multiple line items and pressing Shift - F2 the given bellow message appears.
    Select only one entry
    Message no. F5A156
    We require deleting more than 1500 payment entries from Petty cash book
    We have list of those accounting document that needs to be Reversed/Deleted from FBCJ
    Please Guide me as to how can we Mass Delete these entries.
    Regards
    Chirag Shah

    Dear Chirag,
    please read the SAP note 529984 that can help.
    Mauri

  • How reset Acrobat form field using javascript API

    How reset Acrobat form field using javascript API

    There are several ways:
    resetForm(["Text1"]);
    or
    getField("Text1").value = getField("Text1").defaultValue;
    George

  • Read-Only Text Field Using JavaScript Code

    I'd like to make a text field read-only by using JavaScript and also having IF & ELSE statements.
    I want it to be like this:
    if the answer from the dropdown menu is YES, then the text field is read only but if the answer is NO then the text field is fillable.
    Thanks in advance

    Use this code as the custom validation script of the drop-down in question:
    this.getField("Text1").readonly = (event.value=="Yes");

  • Need programming help: Three Items selected, only one item displays.

    All the code is below.
    My client has a beach-wear website. It is VERY simple with three pages: Index, Order, and Invoice Page. If customers select the checkbox in front of three items, only one item is displayed on the invoice page. Why aren't all three displayed? I am new to programming:
    //INDEX PAGE:
    <title>Beachwear Title</title>
    <body bgcolor="#FFFFFF">
    <p> </p>
    <form name="form1" method="get" action="jserv/Search.jsp">
    <table width="52%" border="1">
    <tr>
    <td width="20%">Enter Color:</td>
    <td width="80%">
    <input type="text" name="txtColor" size="30" maxlength="20">
    </td>
    </tr>
    </table>
    <p>
    <input type="submit" name="Submit" value="Color">
    </p>
    </form>
    <p> </p>
    //SEARCH PAGE:
    <%@page language="java" import="java.sql.*"%>
    <%@ include file="../Connections/connBeachwear.jsp" %>
    <%
    String rsBeachwear__varColor = "%";
    if (request.getParameter ("txtColor") !=null) {rsBeachwear__varColor = (String)request.getParameter ("txtColor");}
    %>
    <%
    Driver DriverrsBeachwear = (Driver)Class.forName(MM_connBeachwear_DRIVER).newInstance();
    Connection ConnrsBeachwear = DriverManager.getConnection(MM_connBeachwear_STRING,MM_connBeachwear_USERNAME,MM_connBeachwear_PASSWORD);
    PreparedStatement StatementrsBeachwear = ConnrsBeachwear.prepareStatement("SELECT ID, Item, Color, Size FROM Beachwear WHERE Color LIKE '%" + rsBeachwear__varColor + "%';");
    ResultSet rsBeachwear = StatementrsBeachwear.executeQuery();
    boolean rsBeachwear_isEmpty = !rsBeachwear.next();
    boolean rsBeachwear_hasData = !rsBeachwear_isEmpty;
    Object rsBeachwear_data;
    int rsBeachwear_numRows = 0;
    %>
    <%
    int Repeat1__numRows = 10;
    int Repeat1__index = 0;
    rsBeachwear_numRows += Repeat1__numRows;
    %>
    <title>Beachwear Title</title>
    <body bgcolor="#FFFFFF">
    <p> </p>
    <p> 
    <form name="form2" method="post" action="Invoice.jsp">
    <table width="75%" border="1">
    <% while ((rsBeachwear_hasData)&&(Repeat1__numRows-- != 0)) { %>
    <tr>
    <td width="18%"><%=(((rsBeachwear_data = rsBeachwear.getObject("ID"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    <td width="20%"><%=(((rsBeachwear_data = rsBeachwear.getObject("Item"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    <td width="21%"><%=(((rsBeachwear_data = rsBeachwear.getObject("Color"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    <td width="5%"><%=(((rsBeachwear_data = rsBeachwear.getObject("Size"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    <td width="16%">
    <input type="checkbox" name="valueCheckbox" value="<%=(((rsBeachwear_data = rsBeachwear.getObject("ID"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%>">
    </td>
    </tr>
    <%
    Repeat1__index++;
    rsBeachwear_hasData = rsBeachwear.next();
    %>
    </table>
    <p>
    <input type="submit" name="Submit" value="Submit">
    </p>
    </form>
    <%
    rsBeachwear.close();
    ConnrsBeachwear.close();
    %>
    //INVOICE PAGE:
    <%@page language="java" import="java.sql.*"%>
    <%@ include file="../Connections/connBeachwear.jsp" %>
    <%
    String rsBeachwear__varCheckbox = "1";
    if (request.getParameter ("valueCheckbox") !=null) {rsBeachwear__varCheckbox = (String)request.getParameter ("valueCheckbox")   ;}
    %>
    <%
    Driver DriverrsBeachwear = (Driver)Class.forName(MM_connBeachwear_DRIVER).newInstance();
    Connection ConnrsBeachwear = DriverManager.getConnection(MM_connBeachwear_STRING,MM_connBeachwear_USERNAME,MM_connBeachwear_PASSWORD);
    PreparedStatement StatementrsBeachwear = ConnrsBeachwear.prepareStatement("SELECT ID, Item, Color, Size FROM Beachwear WHERE ID IN (" + rsBeachwear__varCheckbox + ")");
    ResultSet rsBeachwear = StatementrsBeachwear.executeQuery();
    boolean rsBeachwear_isEmpty = !rsBeachwear.next();
    boolean rsBeachwear_hasData = !rsBeachwear_isEmpty;
    Object rsBeachwear_data;
    int rsBeachwear_numRows = 0;
    %>
    <%
    int Repeat1__numRows = 10;
    int Repeat1__index = 0;
    rsBeachwear_numRows += Repeat1__numRows;
    %>
    <title>Beachwear Title</title>
    <body bgcolor="#FFFFFF">
    <p> </p>
    <p> 
    <p><br>
    INVOICE<br>
    <br>
    </p>
    <table width="75%" border="1">
    <% while ((rsBeachwear_hasData)&&(Repeat1__numRows-- != 0)) { %>
    <tr>
    <td width="18%"><%=(((rsBeachwear_data = rsBeachwear.getObject("ID"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    <td width="20%"><%=(((rsBeachwear_data = rsBeachwear.getObject("Item"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    <td width="21%"><%=(((rsBeachwear_data = rsBeachwear.getObject("Color"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    <td width="5%"><%=(((rsBeachwear_data = rsBeachwear.getObject("Size"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <%
    Repeat1__index++;
    rsBeachwear_hasData = rsBeachwear.next();
    %>
    </table>
    <p>  </p>
    <%
    rsBeachwear.close();
    ConnrsBeachwear.close();
    %>

    Hi, Brad,
    I appreciate your help! I am a beginning Java student, so this code is more complex than what I can handle alone.
    A copy of the compilation error is at the very bottom of this message.
    I added " int chkValues[]; " to the beginning of your code, and then inserted the whole code snippet to the detail (Invoice) page as shown:
    <%@page language="java" import="java.sql.*"%>
    <%@ include file="../Connections/connBeachwear.jsp" %>
    <%
    String rsBeachwear__varCheckbox = "1";
    if (request.getParameter ("valueCheckbox") !=null) {rsBeachwear__varCheckbox = (String)request.getParameter ("valueCheckbox")   ;}
    %>
    <%
    Driver DriverrsBeachwear = (Driver)Class.forName(MM_connBeachwear_DRIVER).newInstance();
    Connection ConnrsBeachwear = DriverManager.getConnection(MM_connBeachwear_STRING,MM_connBeachwear_USERNAME,MM_connBeachwear_PASSWORD);
    int chkValues[];
    StringBuffer prepStr=new StringBuffer("SELECT ID, Item, Color, Size FROM Beachwear WHERE ID=");
    for(int x=0;x<chkValues.length;++x){
    prepStr.append( chkValues[x] );//using an x instead of an i
    if((x+1)<chkValues.length){//another iteration
    prepStr.append(" OR ID=");
    }//end if
    }//end for loop
    PreparedStatement StatementrsBeachwear = ConnrsBeachwear.preparedStatement(prepStr);
    ResultSet rsBeachwear = StatementrsBeachwear.executeQuery();
    boolean rsBeachwear_isEmpty = !rsBeachwear.next();
    boolean rsBeachwear_hasData = !rsBeachwear_isEmpty;
    Object rsBeachwear_data;
    int rsBeachwear_numRows = 0;
    %>
    <%
    int Repeat1__numRows = -1;
    int Repeat1__index = 0;
    rsBeachwear_numRows += Repeat1__numRows;
    %>
    <title>Beachwear Title</title>
    <body bgcolor="#FFFFFF">
    <p> </p>
    <p> 
    <form name="form1" method="post" action="">
    <p><br>
    INVOICE<br>
    <br>
    </p>
    <% while ((rsBeachwear_hasData)&&(Repeat1__numRows-- != 0)) { %>
    <table width="75%" border="1">
    <tr>
    <td width="13%">ID:</td>
    <td width="87%"><%=(((rsBeachwear_data = rsBeachwear.getObject("ID"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <tr>
    <td width="13%">ITEM:</td>
    <td width="87%"><%=(((rsBeachwear_data = rsBeachwear.getObject("Item"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <tr>
    <td width="13%">COLOR:</td>
    <td width="87%"><%=(((rsBeachwear_data = rsBeachwear.getObject("Color"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <tr>
    <td width="13%">SIZE:</td>
    <td width="87%"><%=(((rsBeachwear_data = rsBeachwear.getObject("Size"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    </table>
    <%
    Repeat1__index++;
    rsBeachwear_hasData = rsBeachwear.next();
    %>
    <p>  </p>
    </form>
    <%
    rsBeachwear.close();
    ConnrsBeachwear.close();
    %>
    ERROR:
    500 Internal Server Error
    /jserv/Invoice.jsp:
    Compilation error occured:
    Found 1 errors in JSP file:
    C:\\Inetpub\\wwwroot\\Beachwear\\jserv\\Invoice.jsp:27: Error: No method named "preparedStatement" was found in type "java/sql/Connection".
    allaire.jrun.scripting.DefaultCFE:
    Errors reported by compiler:C:/Program Files/Allaire/JRun/servers/default/default-app/WEB-INF/jsp/jrun__jserv__Invoice2ejsp12.java:82:42:82:83: Error: No method named "preparedStatement" was found in type "java/sql/Connection".
         at allaire.jrun.scripting.JavaCompilerService.compile(../scripting/JavaCompilerService.java:96)

  • How can I pass variables from one project to another using Javascript?

    Hi all, I am trying to do this: let learners take one course and finish a quiz. Then based on their quiz scores, they will be sent to other differenct courses.
    However, I wish keep track on their previous quiz scores as well as many other variables.
    I found this nice widge of upload/download variables by CPguru (http://www.cpguru.com/2011/05/18/save-and-load-data-widget-for-adobe-captivate-4-and-adobe -captivate-5/). However, this widget works by storing variables from one project in local computer and then upload it to another project.
    My targeted learners may not always use the same computer though, so using this widget seems not work.
    All these courses resided in a local-made LMS which I don't have access to their code. Therefore, passing variables to PHP html files seems not work.
    Based on my limited programing knowledge, I assume that using Javascript to pass variables may be the only possible way.
    Can someone instruct me how to do this?
    Thank you very much.

    If you create two MIDlet in a midlet suite, it will display as you mentioned means you can't change the display style.

  • Oracle database link to MySQL select only one row

    Hello,
    I have created a connection from the Oracle batabase 11.2 to a MySQL database via database link. The following statement shows, that 35 rows are in the mySQL table:
    SQL>  select count(*) from "main_pages"@MOREWEB;
      COUNT(*)
            35
    But a normal select statement only return 1 row.
    SQL> select "subject" from "main_pages"@MOREWEB;
    subject
    Übersicht: Referenzen
    I am using the mysql-connector-odbc-3.51.30-winx64 driver. A newer version cann't be installed because on Windows Server 2008 R2 I get an error with an missing dll-file. The DataDirect-ODBC-driver is not possible, because we like to use the free MySQL-database an DataDirect only support the enterprise edition.
    I also have tried to limit the HS_OPEN_CURSORS or dont limit the HS_FDS_FETCH_ROWS, but there is no difference in the result. I always get only one row.
    HS Init.ora
    # This is a sample agent init file that contains the HS parameters that are
    # needed for the Database Gateway for ODBC
    # HS init parameters
    HS_FDS_CONNECT_INFO = moreweb
    HS_FDS_TRACE_LEVEL = ON
    HS_FDS_FETCH_ROWS=1
    # Environment variables required for the non-Oracle system
    #set <envvar>=<value>
    HS tracefile
    Oracle Corporation --- MITTWOCH   NOV 05 2014 13:56:22.066
    Heterogeneous Agent Release
    11.2.0.1.0
    Oracle Corporation --- MITTWOCH   NOV 05 2014 13:56:22.066
        Version 11.2.0.1.0
    HOSGIP for "HS_FDS_TRACE_LEVEL" returned "ON"
    HOSGIP for "HS_OPEN_CURSORS" returned "50"
    HOSGIP for "HS_FDS_FETCH_ROWS" returned "1"
    HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
    HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
    HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
    HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
    HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
    HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
    HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
    HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
    HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
    HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
    HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
    HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
    HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
    HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
    HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
    using mpgw as default value for "HS_FDS_DEFAULT_OWNER"
    HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
    SQL text from hgopars, id=1, len=36 ...
         00: 53454C45 43542043 4F554E54 282A2920  [SELECT COUNT(*) ]
         10: 46524F4D 20606D61 696E5F70 61676573  [FROM `main_pages]
         20: 60204131                             [` A1]
    Deferred open until first fetch.
    Performing delayed open.
    SQL text from hgopars, id=1, len=40 ...
         00: 53454C45 43542041 312E6073 75626A65  [SELECT A1.`subje]
         10: 63746020 46524F4D 20606D61 696E5F70  [ct` FROM `main_p]
         20: 61676573 60204131                    [ages` A1]
    Deferred open until first fetch.
    Performing delayed open.
    Please can help me someone.
    Thanks.
    Bianca

    mxallen wrote:
    Bianca,
    If you log directly into MySQL and issue the same query (select "subject" from "main_pages";) what data is returned?
    I looks to me that you count is the number of rows in the entire table "main_pages"
    while you select is for the data in the "subject" column only.
    This seems to indicate that you have just one row in that subject column.
    Regards,
    Matt
    WHAATT?
    What do you mean by "just one row in that subject column"?
    That makes no sense at all.  A row is a row.  A column is a part of a row.  All rows have all columns, though not all columns of all rows will necessarily have an assigned value.  Lacking a WHERE clause to filter rows, any SELECT should return all rows.

  • Retrieve only one type of phone number

    Hi
    In the following sample query I need to retrieve only one phone number. The preference is if Mobile available - mobile number if not Home number (Type - H1), else Work number (W1).
    I have included the script and sample output what I am getting from the SQL
    Thanks in advance
    Regards
    Sriram
    select pp.ph_id
    ,papf.person_id
    ,pp.ph_type
    ,pp.ph_no
    ,pp.date_from
    ,pp.date_to
    from per_phones                      pp
    ,per_all_people_f                    papf
    ,per_contact_relationships           pcr
    where papf.person_id = pp.parent_id
    and pcr.person_id = papf.person_id
    and trunc(sysdate) between trunc(nvl(pcr.date_start, sysdate-1))
    and trunc(nvl(pcr.date_end, sysdate+1))
    and papf.person_id in (146564, 514)
    and pcr.primary_contact_flag  = 'Y'
    and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
    and trunc(sysdate) between nvl(pp.date_from, sysdate-1) and nvl(pp.date_to, sysdate+1);output
    PH_ID     PERSON_ID     PH_TYPE     PH_NO     DATE_FROM     DATE_TO
    3261     514          H1          987524879     13-Jun-04     
    117287     514          M          0403672797     11-May-05     
    141997     146564          H1          54789620     15-Feb-06     05-Mar-10
    311028     146564          H2          235469          5-Dec-09     
    311029     146564          W1          8300054          15-Dec-09     
    311108     146564          M          04126872     12-Feb-10

    Not tested, but something like this might do the trick. What you need to do is assign a hierarchy to the phone type codes, then choose the top one for each parent id.
    WITH phone_list
      AS ( SELECT parent_id,
                  MIN( CASE ph_type
                         WHEN 'M'  THEN 1
                         WHEN 'H1' THEN 2
                         WHEN 'W'  THEN 3
                         ELSE 99
                       END )  AS phone_pref
             FROM per_phones
            GROUP
               BY parent_id )
    SELECT pp.ph_id,
           papf.person_id,
           pp.ph_type,
           pp.ph_no,
           pp.date_from,
           pp.date_to
      FROM per_phones                pp,
           per_all_people_f          papf,
           per_contact_relationships pcr,
           phone_list                lst
      WHERE papf.person_id = pp.parent_id
        AND pcr.person_id = papf.person_id
        AND trunc(sysdate) between trunc(nvl(pcr.date_start, sysdate-1))
        AND trunc(nvl(pcr.date_end, sysdate+1))
        AND papf.person_id in (146564, 514)
        AND CASE pp.ph_type
                         WHEN 'M'  THEN 1
                         WHEN 'H1' THEN 2
                         WHEN 'W'  THEN 3
                         ELSE 99
                       END = lst.phone_pref
       AND pp.parent_id = lst.parent_id;

Maybe you are looking for