PHP form strange behaviors

I have a very basic PHP form coded and whenever I look at it in Live View the bottom third of the processing code appears at the top of the webpage. Uploaded the code does not appear on the webpage and the form works fine, except that the dropdown initial values I have set are ignored.
The form URL:  http://affordableroofingcontractors.com/contact-us.php
The dropdown code: (I want "select one" displayed but the form shows "Re-roofing" instead!?)
<select name="service" id="service">
            <option value="0" selected="selected"
            <?php if (!$_POST ||$_POST['service'] =='0') {
    echo 'selected="selected"'; }?>>--select one--</option>
            <option value="Proactive Roof Maintenance"
            <?php if (!$_POST ||$_POST['service'] =='Proactive Roof Maintenance') {
    echo 'selected="selected"'; }?>>Proactive Roof Maintenance</option>
            <option value="Roof Repairs"
             <?php if (!$_POST ||$_POST['service'] =='Roof Repairs') {
    echo 'selected="selected"'; }?>>Roof Repairs</option>
            <option value="Re-roofing"
             <?php if (!$_POST ||$_POST['service'] =='Re-roofing') {
    echo 'selected="selected"'; }?>>Re-roofing</option>
          </select>
The processing code:
<?php
if (array_key_exists('submit', $_POST)){
//mail processing script
// remove escape characters from POST array
if (PHP_VERSION < 6 && get_magic_quotes_gpc()) {
  function stripslashes_deep($value) {
    $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
    return $value;
  $_POST = array_map('stripslashes_deep', $_POST);
if (!empty($_POST['area'])) {
  $to = '[email protected]';
  $subject = 'SUSPECTED BOT SUBMISSION from ACI quote form';
} else {
$to = '[email protected]';
$subject = 'ACI CONTACT FORM';
//list expected fields
$expected = array('name','company','phone','email','service','building','comments');
//set required fields
$required = array('name','email','phone');
//create empty array for any missing fields
$missing = array();
//assume there is nothing suspect
$suspect = false;
//create a pattern to locate suspect phrases
$pattern = '/Content-Type:|Bcc:|Cc:/i';
   // function to check for suspect phrases
  function isSuspect($val, $pattern, &$suspect) {
  // if the variable is an array, loop through each element and pass it recursively back to the same function
if (is_array($val)) {
      foreach ($val as $item) {
     isSuspect($item, $pattern, $suspect);
    else {
      // if one of the suspect phrases is found, set Boolean to true
   if (preg_match($pattern, $val)) {
        $suspect = true;
//check the Post array and any subarrays for suspect content
isSuspect($_POST, $pattern, $suspect);
if ($suspect) {
$mailSent = false;
unset($missing);
} else {
//process POST variables
foreach ($_POST as $key => $value){
//assign to temporary variable and strip whitespace if not an array
$temp = is_array($value) ? $value : trim($value);
//if empty and required, add to $missing array
if (empty($temp) && in_array($key, $required)) {
  array_push($missing, $key);
} elseif (in_array($key, $expected)) {
//otherwise, assign to a variable of the same name as $key
  ${$key} = $temp;
//validate the email address
if (!empty($email)) {
// regex to identify illegal characters in email address
$checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
//reject the email address if it doesn't match
if (!preg_match($checkEmail, $email)){
  $suspect = true;
  $mailSent = false;
  unset($missing);
//go ahead only if not suspect and all required fields OK
if (!$suspect && empty($missing)) {
//build the message
$message = "Name: $name\r\n\r\n";
$message .= "Company: $company\r\n\r\n";
$message .= "Phone: $phone\r\n\r\n";
$message .= "Email: $email\r\n\r\n";
$message .= "Service Needed: $service\r\n\r\n";
$message .= "Type of Building: $building\r\n\r\n";
$message .= "Comments: $comments";
//limit line length to 70 characters
$message = wordwrap($message, 70);
//create additional headers
$headers = "From: $email>\r\n";
$headers .= 'Content-Type: text/plain; charset=utf-8';
if (!empty($email)) {
  $headers .= "\r\nReply-To: $email";
//send it
$mailSent = mail($to, $subject, $message, $headers);
if ($mailSent) {
//$missing is no longer needed if email is sent, so unset it
unset($missing);
?>

Hi!
To select php form you should create a  menu,  fill out the type of "choice of one item of many" or "Select multiple  items from the many." Must be inside FORM element and have at the start  or end tags. It contains several elements OPTION, otherwise it makes no  sense.
Example:
<HTML> <body>
<form method='post' action='all.php'>
     Color Scheme: <br>
    <SELECT NAME="color">
      <OPTION VALUE="Standard" SELECTED> </ OPTION>
      <OPTION VALUE='Brick'> Brick </ OPTION>
      <OPTION VALUE='Gray Mouse'> Gray Mouse </ OPTION>
      <OPTION VALUE='Ship Bottom'> Ship Bottom </ OPTION>
      <OPTION VALUE='Black Night'> Black Night </ OPTION>
      <OPTION VALUE='White Light'> White Light </ OPTION>
      <OPTION VALUE='Yellow List'> Yellow List </ OPTION>
      <OPTION VALUE='Pink Myth'> Pink Myth </ OPTION>
      <OPTION VALUE='Green USD'> Green USD </ OPTION>
      <OPTION VALUE='Standard'> Standard </ OPTION>
    </ SELECT>
<input type='submit' name='submit' value='go'>
</ form>
</ body> </ HTML>2

Similar Messages

  • Php form - server behavior form not there!

    I figured this out....form name is different than form ID.
    When I go into the server behavior in the authenticate user -
    login user the form name I have labeled in the properties windows
    in not showing up. It only says <unnamed>, however it is
    named login_form. Any ideas? I am stumped.
    I finally figured out the mysql stuff, to get stuck on this
    small detail.

    A.Translator wrote:
    > The form on this page returns a 'form is not filled in
    properly'
    > response
    http://www.spinsister.nl/zandbak/Rood/contact.htm
    This is the line that's causing the trouble:
    > $comments = $_POST['comments'] ;
    Change it to this:
    $comments = $_POST['opmerkingen'];
    Then it should work.
    David Powers
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    http://foundationphp.com/

  • Jdev 10.1.3.4 panel form strange behavior

    The following is the code in jspx page:
    <af:panelForm binding="#{backing_genel_anaSayfa.panelForm1}" id="panelForm1" >
    <af:outputText value="a1" id="id1"/>
    and when I run the code from client and get the "page source" from browser I get:
    <table cellpadding="0" cellspacing="0" border="0" summary="" id="panelForm1">
    <tr>
    <td width="20">
    <script>var AdfWindowOpenError='Gözatıcınızda bir açılan pencere engelleyicisi algılandı. Açılan pencere engelleyicileri bu uygulamanın çalışmasını bozar. Lütfen açılan pencere engelleyicinizi devre dışı bırakın veya bu sitede açılan pencerelere izin verin.';</script><script src="/bahumPortal-ViewController-context-root/adf/jsLibs/Common101_3_4_0.js;jsessionid=92edb673be06e6fa730b35c1181427aebb21535f59795b498e7710ad31839c47"></script><script>var _tURL="/bahumPortal-ViewController-context-root/adf/images/t.gif;jsessionid=92edb673be06e6fa730b35c1181427aebb21535f59795b498e7710ad31839c47";var _axm=1;t(20)</script></td>
    <td width="50%" valign="top"><table cellpadding="0" cellspacing="0" border="0" width="100%" summary="" class="af_panelForm_body">
    and so on.
    There comes a strange td containing a script saying that there is a pop-up blocker. And the td has a width. So it destroys my design.
    Is there a way to not to have it?

    Are you just wondering why that script is appearing in the source or do you have a problem ?
    I am asking this because as I tested I have the same script in my pages' source as below. I guess ADF puts this script for other purposes.
    You have it in Turkish in your page because of your locale settings..
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html dir="ltr" lang="en-US"><head><title>untitled1</title><meta name="generator" content="Oracle ADF Faces">
    <link rel="stylesheet" charset="UTF-8" type="text/css" href="/Adf2-ViewController-context-root/adf/styles/cache/oracle-desktop-10_1_3_4_0-en-gecko.css">
    <script>var _AdfWindowOpenError='A popup window blocker has been detected in your browser. Popup blockers interfere with the operation of this application. Please disable your popup blocker or allow popups from this site.';
    </script>

  • Strange behavior of textareas in BPEL Worklist (10.1.2)

    I have a very strange behavior with linebreaks in all my <textarea>s in the BPEL-Worklist-jsps: (they work fine as <INPUT>s
    Example:
    Default-text:
    line1
    I update the textarea to:
    line1
    line2
    -> hit update
    line1
    *** (second line is completly missing)
    -> hitting update again (no change in text)
    line2line1
    *** (all on one line with the new line in front)
    As Value I use:
    <%=PayloadFormGenerator.selectNodeValue(payload, "/ns0:task/ns0:payload/ns1:abstract", form.getNamespaceMap(),"string", context.getLocale())%>
    and as mentioned: It works fine for <INPUT>.
    What do I do wrong? Is this a bug?
    Daniel
    Message was edited by:
    user552073

    Had the same problem, could not get it to be consistent. I would say this is a bug, but decided to edit payloads via the database in the end...

  • Php form used twice

    DWCS3 & PHP / MySQL
    Can a PHP form be used for two events? Example have the user
    type their
    user name to retrieve their information. The make any changes
    to their
    personal data, and update the database with that information.
    I'm thinking
    two buttons and two server behaviors.
    Is there a way to only allow them to change their own data
    without adding
    permission levels into the database?

    On 02 May 2008 in macromedia.dreamweaver, Striker wrote:
    > Can a PHP form be used for two events? Example have the
    user type
    > their user name to retrieve their information. The make
    any changes
    > to their personal data, and update the database with
    that
    > information. I'm thinking two buttons and two server
    behaviors.
    Updating their information is only one event.
    > Is there a way to only allow them to change their own
    data without
    > adding permission levels into the database?
    Don't give them access to those fields.
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/contact.php

  • Strange behavior in HTMLDB

    Greetings,
    We've been running HTMLDB since 1.5 and are currently at 2.2.1.00.04, but within the last two weeks we have been seeing some very strange behavior. Form submissions or moving from one page to the next in either the Development GUI or within any application will result in either blank pages (although in most cases a reload [refresh] will bring up the page that was expected) or the following errors:
    Error Workspace 741023382320307 has no privileges to parse as schema.
    or
    Access denied by Application security check (this one will only allow us to logout, refresh doesnt work).
    or
    ORA-0000: normal, successful completion
    Error Unable to fetch authentication_scheme in application 4000. (a refresh brings the page up normally)
    We've made no major changes to hardware/operating system/software.
    We have ruled out our load balancer by accessing htmldb by FQDN and port number, and have disabled webcache. Its almost as if our session variables in memory will just suddenly disappear.
    [EDIT]
    These pages and errors are absolutely random. I could experience 20 of them in an hour or 1 in the next week. We have done extensive log checking, but can find nothing that would explain the behavior.
    [EDIT]
    Has anyone experienced these issues. We are currently running a number of applications in production and this is already starting to affect them.
    Thanks in Advance,
    Clifford Moon
    Message was edited by:
    cjmoon
    Message was edited by:
    cjmoon

    Hi Earl.
    I just confirmed from one of the developers that it
    happens either way...
    Any ideas?
    cliffDid you happen to change browsers recently, like IE7 perhaps?
    I'm not really sure what's happening but this sounds like what I call 'browser confusion'. Basically, like what you mentioned, that the current session state gets dropped, either in the browser or the server. Don't know which.
    Earl

  • Strange behavior in a table with dropTarget and delete action

    I am having a strange behavior in a table with drag and drop and action component to delete row.
    Steps:
    Drag the first row to the table and appears in the destination table (works well)
    Select and change the value by 156, appears an error (works fine)
    delete the row, the row disappears (works well)
    Add the first row again and the value is 156 instead of 158 (why ????)
    I guess the error is the deletion that is not correct, but do not know how?
    Can anyone help?
    I add the source code if you see where I'm wrong
    Java class:
    +public class BeanExample {+
    private ArrayList<RowExample> starttValues;
    private ArrayList<RowExample> endValues;
    +public BeanExample() {+
    super();
    +}+
    +public void setStarttValues(ArrayList<BeanExample.RowExample> starttValues) {+
    this.starttValues = starttValues;
    +}+
    +public ArrayList<BeanExample.RowExample> getStarttValues() {+
    +if (starttValues == null) {+
    starttValues = new ArrayList<BeanExample.RowExample>();
    starttValues.add(new RowExample("1", new Number(158)));
    starttValues.add(new RowExample("21", new Number(12565464)));
    +}+
    return starttValues;
    +}+
    +public void setEndValues(ArrayList<BeanExample.RowExample> endValues) {+
    this.endValues = endValues;
    +}+
    +public ArrayList<BeanExample.RowExample> getEndValues() {+
    +if (endValues == null) {+
    endValues = new ArrayList<BeanExample.RowExample>();
    +}+
    return endValues;
    +}+
    +public void validatorExample(FacesContext facesContext, UIComponent uIComponent, Object object) {+
    Number number = (Number)object;
    +if ((number.longValue() % 2) == 0) {+
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "ES PAR", "ES PAR");
    throw new ValidatorException(message);
    +}+
    +}+
    +public DnDAction handleDrop(DropEvent dropEvent) {+
    Transferable transferable = dropEvent.getTransferable();
    DataFlavor<RowKeySet> rowKeySetFlavor = DataFlavor.getDataFlavor(RowKeySet.class, "loteDrag");
    RowKeySet rowKeySet = transferable.getData(rowKeySetFlavor);
    +if (rowKeySet != null) {+
    CollectionModel dragModel = transferable.getData(CollectionModel.class);
    +if (dragModel != null) {+
    Object currKey = rowKeySet.iterator().next();
    dragModel.setRowKey(currKey);
    RowExample table = (RowExample)dragModel.getRowData();
    getEndValues().add(new RowExample(table.getId(), table.getValue()));
    return dropEvent.getProposedAction();
    +}+
    +}+
    return DnDAction.NONE;
    +}+
    +public void borrarFila(ActionEvent actionEvent) {+
    endValues.remove(0);            RequestContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc1:t2"));
    +}+
    +public static class RowExample {+
    private String id;
    private Number value;
    +public RowExample(String id, Number value) {+
    super();
    this.id = id;
    this.value = value;
    +}+
    +public void setId(String id) {+
    this.id = id;
    +}+
    +public String getId() {+
    return id;
    +}+
    +public void setValue(Number value) {+
    this.value = value;
    +}+
    +public Number getValue() {+
    return value;
    +}+
    +}+
    +}+JSF
    +<?xml version='1.0' encoding='windows-1252'?>+
    +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"+
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    +<jsp:directive.page contentType="text/html;charset=windows-1252"/>+
    +<f:view>+
    +<af:document id="d1">+
    +<af:form id="f1">+
    +<af:panelGroupLayout id="pgl1">+
    +<af:table value="#{beanExample.starttValues}" var="row"+
    rowBandingInterval="0" id="t1" rowSelection="single"
    displayRow="selected" contentDelivery="immediate">
    +<af:column sortable="false" headerText="Id" align="start" id="c2">+
    +<af:outputText value="#{row.id}" id="ot1"/>+
    +</af:column>+
    +<af:column sortable="false" headerText="Value" align="start" id="c1">+
    +<af:outputText value="#{row.value}" id="ot2"/>+
    +</af:column>+
    +<af:collectionDragSource actions="COPY" modelName="loteDrag"/>+
    +</af:table>+
    +<af:panelCollection id="pc1">+
    +<f:facet name="toolbar" >+
    +<af:toolbar id="dc_t2" >+
    +<af:commandToolbarButton shortDesc="Delete"+
    icon="/imagesDemo/delete_ena.png"
    id="dc_ctb3" immediate="true"
    +actionListener="#{beanExample.borrarFila}"/>+
    +</af:toolbar>+
    +</f:facet>+
    +<af:table value="#{beanExample.endValues}" var="row"+
    +rowBandingInterval="0" id="t2">+
    +<af:column sortable="false" headerText="Id" align="start" id="c3">+
    +<af:outputText value="#{row.id}" id="ot3"/>+
    +</af:column>+
    +<af:column sortable="false" headerText="Value" align="start" id="c4" >+
    +<af:inputText value="#{row.value}" autoSubmit="true" id="it1" validator="#{beanExample.validatorExample}"/>+
    +</af:column>+
    +<af:collectionDropTarget actions="COPY" modelName="loteDrag"+
    +dropListener="#{beanExample.handleDrop}"/>+
    +</af:table>+
    +</af:panelCollection>+
    +</af:panelGroupLayout>+
    +</af:form>+
    +</af:document>+
    +</f:view>+
    +</jsp:root>+

    I think the problem is the validator
    I changed the practical case, I added an InputText to enter new values in the first row.
    +<af:inputText immediate="true" label="new value" id="it2"+
    +valueChangeListener="#{beanExample.newvalue}" autoSubmit="true"/>+
    +public void newvalue (ValueChangeEvent valueChangeEvent) {+
    +String valor = (String)valueChangeEvent.getNewValue();+
    +Number valorNumber=null;+
    +try {+
    +valorNumber = new Number (valor);+
    +} catch (SQLException e) {+
    +}+
    +RowExample example = (RowExample) endValues.get(0);+
    +example.setValue(valorNumber);+
    +example.setId(valorNumber.toString());+
    +RichTable table = (RichTable)FacesContext.getCurrentInstance().getViewRoot().findComponent(id);+
    +RequestContext.getCurrentInstance().addPartialTarget(table);+
    +}+
    Case 1
    I drag the first row to the target table (ok)
    The new row appears (ok)
    Enter the value 77 in the InputText (ok)
    id content and value change (ok)
    Case2
    I drag the first row to the destination table
    The new row appears (ok)
    Change the value of the first row by 80 (ok)
    errors appears (by validator) (ok)
    Enter the value 77 in the InputText (ok)
    the id is changed but the value NO (*KO*)
    I do not understand the behavior
    Edited by: josefuente on 27-oct-2010 16:03

  • Strange behavior with Firefox

    Hi Team,
    I am using HTMLDB V2.0 and Firefox V1.5.0.1. I used wizard to create a report/form application. However, when I press a button to update the form all the buttons line up in a vertical row and I then have to press the same button again.
    My application is 30412 at htmldb.oracle.com. The problem is occurring at page 4. Go to page 3 (2nd tab) and select any record. You will be directed to page 4. Then when you press any button (cancel, create, delete, apply changes) on page 4, page 4 is refreshed and the buttons strangely line up in a vertical column. I then have to press the same button again before the update occurs.
    I have the same report/form setup on pages 1 and 2 and it is working fine on those pages.
    This strange behavior is not occurring in IE. I also notice that the font size is bigger in IE .
    I would appreciate any help you might offer.
    I really enjoy working with HTMLDB.
    Thanks, Andy

    Sorry about that. I removed all the authorization schemes from the application. I also changed the authentication scheme to HTMLDB. Let me know if I need to do something more for you to get access.
    Thanks for looking at it.
    I think it may have something to do with the "button, alternative 3" template from theme 3 that I am using. When I switch to the "button" template from theme 3 then the strange behavior goes away in Firefox.
    Andy

  • Strange Behavior of af:inputListOfValues

    Hi,
    I've tried the demo for How-to build Oracle Forms style List-of-Values in ADF Faces RC at [http://www.oracle.com/technology/products/jdev/tips/fnimphius/lov/listOfValues.html|http://www.oracle.com/technology/products/jdev/tips/fnimphius/lov/listOfValues.html] .
    As it's shown in the example if you enter SA_ the JobId field in the LOV is filled with SA_%.
    Yes this happens only the first time you enter a value. After the first time, the result is a blank field.
    Does anybody know how to solve this strange behavior?
    I'm using JDeveloper 11g build 5188.
    Regards,
    JavaDeVeLoper

    Hi,
    I see this too. However, the source code works and it seems to be a refresh issue with the applied criteria
    Frank

  • Strange Behavior of program while using BAPI_PO_CREATE1

    Hello SAP GURUs,
    I've created an Upload Program using BAPI_PO_CREATE1 for Mass Service PO Creation.
    When I execute the program and Specify the File for uploading, It Gives me errors as
    E     BAPI     1     No instance of object type PurchaseOrder has been created. External reference:
    E     MEPO     0     Purchase order still contains faulty items
    E     6     436     In case of account assignment, please enter acc. assignment data for item
    But when I come back to Selection Screen of the Program and specify the SAME FILE AGAIN and Execute,
    The Program runs successfully and generates the PO number.
    I have never seen such strange behavior in any BAPIs before.
    Pls help..

    PERFORM refresh_tables.
      PERFORM fill_tables.
    END-OF-SELECTION.
    Display the Summary as an ALV Grid Display
      IF NOT ig_mymssg[] IS INITIAL.
        PERFORM display_basic_list . "Grid Display
      ELSE.
        MESSAGE s000 WITH 'No data exists'(051).
        STOP.
      ENDIF.
    *&      Form  refresh_tables
          text
    -->  p1        text
    <--  p2        text
    FORM refresh_tables .
      REFRESH:   ig_fieldcat,
                 ig_mymssg,
                 poitem,
                 poitemx,
                 poaccount,
                 poaccountx,
                 poservices,
                 ig_return.
                wt_itab,  record,  record2 .
    ENDFORM.                    " refresh_tables
    *&      Form  fill_tables
          text
    -->  p1        text
    <--  p2        text
    FORM fill_tables .
      record2[] = record[].
      record3[] = record[].
      DELETE ADJACENT DUPLICATES FROM record COMPARING id_no.
      DELETE ADJACENT DUPLICATES FROM record2 COMPARING id_no po_item.
      SELECT MAX( packno ) FROM esll INTO wrk_packno.
      LOOP AT record.
        CLEAR : poheader, poheaderx, wa_poitem, wa_poitemx, wa_poservices, wa_poaccount, wa_poaccountx, wa_poschedulex, wa_poschedule.
        REFRESH: poitem, poitemx, poaccount, poaccountx, poservices, ig_return,  posrvaccessvalues, poschedule, poschedulex.
        PERFORM po_header.
        LOOP AT record2 WHERE id_no = record-id_no.
          wrk_packno = wrk_packno + 1.
          PERFORM po_item.
          PERFORM po_scheudle.
          PERFORM acc_assignment.
          PERFORM po_services.
        ENDLOOP.
        PERFORM create_po.
      ENDLOOP.
    ENDFORM.                    " fill_tables
    *&      Form  display_basic_list
          text
    -->  p1        text
    <--  p2        text
    FORM display_basic_list .
      g_repid = sy-repid.
      PERFORM f2000_fieldcat_init .
      PERFORM display_alv_grid_1.
    ENDFORM.                    " display_basic_list
    *&      Form  f2000_fieldcat_init
          text
    -->  p1        text
    <--  p2        text
    FORM f2000_fieldcat_init .
      REFRESH ig_fieldcat.
      PERFORM fill_fields_of_fieldcatalog USING 'IG_MYMSSG'
                                                  'STATUS'
                                                    c_x
                                                    'Status'
                                                    '10'.
      PERFORM fill_fields_of_fieldcatalog USING 'IG_MYMSSG'
                                                'RECORD'
                                                c_x
                                                'Record'
                                                '20'.
      PERFORM fill_fields_of_fieldcatalog USING 'IG_MYMSSG'
                                                'ERRMSG'
                                                'Message'
                                                '100'.
    ENDFORM.                    " f2000_fieldcat_init
    *&      Form  display_alv_grid_1
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv_grid_1 .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = g_repid
          i_structure_name   = 'IG_MYMSSG'
          i_grid_title       = 'LOG'
          is_layout          = wg_layout
          it_fieldcat        = ig_fieldcat[]
          i_save             = c_save
        TABLES
          t_outtab           = ig_mymssg
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
      IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " display_alv_grid_1
    *&      Form  fill_fields_of_fieldcatalog
          text
         -->P_0626   text
         -->P_0627   text
         -->P_C_X  text
         -->P_0629   text
         -->P_0630   text
    FORM fill_fields_of_fieldcatalog  USING    p_tabname TYPE slis_tabname
                                               p_field TYPE slis_fieldname
                                               p_key TYPE c
                                               p_name
                                               len.
    To fill in the fields of the table fieldcatalog depending on the field
      CLEAR wg_fieldcat.
      wg_fieldcat-fieldname = p_field. " The field name and the table
      wg_fieldcat-tabname = p_tabname.. " name are the two minimum req
      wg_fieldcat-key = p_key. " Specifies the column as a key
      wg_fieldcat-seltext_l = p_name. " Column Header
      wg_fieldcat-outputlen = len.
      APPEND wg_fieldcat TO ig_fieldcat.
    ENDFORM.                    " fill_fields_of_fieldcatalog
    *&      Form  create_po
          text
    -->  p1        text
    <--  p2        text
    FORM create_po .
      CLEAR : wg_return.
      REFRESH : ig_return.
      CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader          = poheader
          poheaderx         = poheaderx
        IMPORTING
          exppurchaseorder  = po_no
        TABLES
          return            = ig_return
          poitem            = poitem
          poitemx           = poitemx
          poschedule        = poschedule
          poschedulex       = poschedulex
          poaccount         = poaccount
          poaccountx        = poaccountx
          poservices        = poservices
          posrvaccessvalues = posrvaccessvalues.
      SORT ig_return BY type.
      READ TABLE ig_return INTO wg_return WITH KEY type = 'S'.
      IF sy-subrc EQ 0.
        CLEAR : wg_return.
        REFRESH : ig_return.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        CLEAR wg_errmsg.
        WRITE icon_green_light AS ICON TO wg_errmsg-status.
        CONCATENATE record-id_no po_no INTO wg_errmsg-record SEPARATED BY '/'.
       wg_errmsg-record = po_no.
        wg_errmsg-errmsg = 'PO created'.
        APPEND wg_errmsg TO ig_mymssg.
      ELSE.
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
        READ TABLE ig_return INTO wg_return WITH KEY type = 'E' TRANSPORTING message.
        CLEAR wg_errmsg.
        WRITE icon_red_light AS ICON TO wg_errmsg-status.
        wg_errmsg-record = record-id_no.
        wg_errmsg-errmsg = wg_return-message.
        APPEND wg_errmsg TO ig_mymssg.
      ENDIF.
    ENDFORM.                    " create_po
    *&      Form  po_header
          text
    -->  p1        text
    <--  p2        text
    FORM po_header .
      poheader-comp_code   = record-comp_code.
      poheader-doc_type    = record-doc_type.
      poheader-vendor      = record-vendor.
      poheader-purch_org   = 'SERV'.
      poheader-pur_group   = record-pur_group.
      poheader-currency    = 'INR'.
      poheaderx-comp_code   = 'X'.
      poheaderx-doc_type    = 'X'.
      poheaderx-vendor      = 'X'.
      poheaderx-purch_org   = 'X'.
      poheaderx-pur_group   = 'X'.
      poheaderx-currency    = 'X'.
    ENDFORM.                    " po_header
    *&      Form  po_item
          text
    -->  p1        text
    <--  p2        text
    FORM po_item .
    DATA : days TYPE num2.
    DATA : final_dt TYPE datum.
    DATA : is_ok TYPE boole_d.
    DATA : msg_hndlr TYPE REF TO if_hrpa_message_handler.
    days = 20.
    CALL FUNCTION 'HR_ECM_ADD_PERIOD_TO_DATE'
       EXPORTING
         orig_date       = sy-datum
         num_days        = days
         signum          = '+'
         message_handler = msg_hndlr
       IMPORTING
         result_date     = final_dt
         is_ok           = is_ok.
      CLEAR: wa_poitem,wa_poitemx.
      wa_poitem-po_item      = record2-po_item.
      wa_poitem-short_text   = record2-short_text.
      wa_poitem-plant        = record2-plant.
      wa_poitem-matl_group   = 'S001'.
      wa_poitem-tax_code     = 'LA'.
      wa_poitem-item_cat     = item_cat.
      wa_poitem-pckg_no      = wrk_packno.
      wa_poitem-acctasscat   = acctasscat.
    wa_poitem-gr_to_date   = final_dt.
      APPEND wa_poitem TO poitem.
      wa_poitemx-po_item      = record2-po_item.
      wa_poitemx-po_itemx      = 'X'.
      wa_poitemx-short_text   = 'X'.
      wa_poitemx-plant        = 'X'.
      wa_poitemx-tax_code     = 'X'.
      wa_poitemx-item_cat     = 'X'.
      wa_poitemx-acctasscat   = 'X'.
      wa_poitemx-pckg_no      = 'X'.
      wa_poitemx-matl_group   = 'X'.
      wa_poitem-gr_to_date    = 'X'.
      APPEND wa_poitemx TO poitemx.
    ENDFORM.                    " po_item
    *&      Form  PO_SERVICES
          text
    -->  p1        text
    <--  p2        text
    FORM po_services .
      CLEAR: wa_poservices, wa_posrvaccessvalues.
      wa_poservices-pckg_no = wrk_packno.
      wa_poservices-line_no  = '0000000001'.
      wa_poservices-outl_ind = 'X'.
      wa_poservices-subpckg_no = wa_poservices-pckg_no + 1.
      wa_poservices-from_line = '000001'.
      APPEND wa_poservices TO poservices.
      CLEAR wa_poservices.
      wrk_packno = wrk_packno + 1.
      wa_poservices-pckg_no = wrk_packno.
      wa_poservices-line_no  = '0000000002'.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = record2-service
        IMPORTING
          output = record2-service.
      wa_poservices-ext_line = '0000000010'.
      wa_poservices-service  = record2-service.
      wa_poservices-quantity = record2-quantity.
      wa_poservices-gr_price = record2-gr_price.
      wa_posrvaccessvalues-pckg_no = wrk_packno.
      wa_posrvaccessvalues-line_no = '0000000002'.
      wa_posrvaccessvalues-serial_no = '01'.
      wa_posrvaccessvalues-serno_line = '01'.
    wa_posrvaccessvalues-quantity = record2-quantity.
    wa_posrvaccessvalues-net_value = record2-gr_price.
      APPEND wa_poservices TO poservices.
      APPEND wa_posrvaccessvalues TO posrvaccessvalues.
    ENDFORM.                    " PO_SERVICES
    *&      Form  ACC_ASSIGNMENT
          text
    -->  p1        text
    <--  p2        text
    FORM acc_assignment .
      DATA : tmp_gl LIKE bapimepoaccount-gl_account.
      tmp_gl = '400265'.
      CLEAR : wa_poaccount, wa_poaccountx.
      wa_poaccount-po_item      =  record2-po_item.
      wa_poaccount-serial_no    = '01'.
      wa_poaccount-co_area      = '1000'.
      wa_poaccount-quantity     = record2-quantity.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = tmp_gl
        IMPORTING
          output = wa_poaccount-gl_account.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = record2-orderid
        IMPORTING
          output = wa_poaccount-orderid.
      APPEND wa_poaccount TO poaccount.
      wa_poaccountx-po_item      = record2-po_item.
      wa_poaccountx-serial_no    = '01'.
      wa_poaccountx-co_area      = 'X'.
      wa_poaccountx-quantity     = 'X'.
      wa_poaccountx-gl_account   = 'X'.
      wa_poaccountx-orderid      = 'X'.
      APPEND wa_poaccountx TO poaccountx.
    ENDFORM.                    " ACC_ASSIGNMENT
    *&      Form  PO_SCHEUDLE
          text
    -->  p1        text
    <--  p2        text
    FORM po_scheudle .
      CLEAR : wa_poschedule, wa_poschedulex.
      wa_poschedule-po_item = record2-po_item.
      wa_poschedule-sched_line = '0001'.
    wa_poschedule-del_datcat_ext = 'D'.
      wa_poschedule-delivery_date = sy-datum.
      wa_poschedule-quantity = record2-quantity.
      APPEND wa_poschedule TO poschedule.
      wa_poschedulex-po_item = record2-po_item.
      wa_poschedulex-sched_line = '0001'.
      wa_poschedulex-po_itemx = 'X'.
      wa_poschedulex-sched_linex = 'X'.
    wa_poschedulex-del_datcat_ext = 'X'
      wa_poschedulex-delivery_date = 'X'.
      wa_poschedulex-quantity = 'X'.
      APPEND wa_poschedulex TO poschedulex.
    ENDFORM.                    " PO_SCHEUDLE

  • Strange behavior of HtmlPanelGrid.getChildren().clear();

    I have some problem, described in previous messages.
    Investigating it, I found some strange behavior, which I cannot understand.
    I builded a small application to isolate this strangeness.
    There are two pages, first and second. There are hyperlinks from first page to second. Secon page serves as an indicator, that navigation was successfull. It is not so all the time.
    There is a bean, which constructs a hyperlink at runtime and which contains my problem, as I think.
    The config file is (header and footer skipped):
    <navigation-rule>
    <from-view-id>/welcomeJSF.jsp</from-view-id>
    <navigation-case>
    <from-outcome>select</from-outcome>
    <to-view-id>/secondPage.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    <managed-bean>
    <managed-bean-name>bean</managed-bean-name>
    <managed-bean-class>Buggy.Bean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    One can see, that navigation is always controlled with the one constant string literal -- select. The bean is called just "bean" and it exists during a session.
    First page is (header and footer skipped):
    <f:view>
    <h:form>
    <h:commandLink id="link1" action="select" value="link1 (hardcoded)"/>
    <h:panelGrid id="panel" binding="#{bean.panel}" columns="20" border="1" cellspacing="0">
    <h:commandLink id="link2" action="select" value="link2 (hardcoded)"/>
    </h:panelGrid>
    </h:form>
    </f:view>
    One can see, that there are two hardcoded hyperlinks, one is inside the panelGrid, second is outside. Also it is seen, that the panel is binded with bean property as a whole.
    The second page is just displaying a text to be sure the navigation occured.
    Now the bean (header and footer skipped):
    private HtmlPanelGrid panel;
    public HtmlPanelGrid getPanel() {
    return panel;
    public void setPanel(HtmlPanelGrid panel) {
    this.panel = panel;
    Application application = FacesContext.getCurrentInstance().getApplication();
    MethodExpression expr = application.getExpressionFactory().createMethodExpression(FacesContext.getCurrentInstance().getELContext(), "select", String.class, new Class[0]);
    HtmlCommandLink link = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
    link.setId("link3");
    link.setValue("link3 (softcoded)");
    link.setActionExpression(expr);
    panel.getChildren().clear();
    panel.getChildren().add(link);
    One can see, that a third (softcoded) hyperlink is added to the panel dynamically, with preliminary clearing panel content.
    * STRANGENESSES *
    1) despite the fact, that the panel is cleared prior to adding softcoded hyperlink, I CAN see it on the page (all 3 hyperlinks are seen)
    2) in the debugger I can see, that while executing code, the children list is empty; this can mean, that the order of execution of the Jave code and JSP code is reversed; despite this fact, I see the hardcoded link BEFORE the softcoded
    3) the link2 (hardcoded) is not work, i.e. it is not leads the second page to be displayed
    4) if I comment the line panel.getChildren().clear(); then all 3 hyperlinks start to work

    But when I put links creation code in bean's constructor, it was lost.
    It seems to me, that the system creates panel independently and only after that calls setter of my bean. Ergo, the data from the panel field, initialized in constructor is overwrited.
    Where I should place programmatic filling of panel element?

  • PHP Form Validation and Insert Records

    Hi There,
    I've been scratching my head for 2 days and couldn't find a solution.
    Here is my problem:
    Go to http://ecopethandbags.com/contactTest.php and click the "Send Comments" button.
    You will see that the validation works.
    Now, go to http://ecopethandbags.com/contactTestInsert.php, this time, I've inserted the "Insert Record" server behavior.
    Click the "Send Comments" button again.
    You will see the ugly message like "Column 'firstname' cannot be null" in a plain white page.
    My question is:
    How can I insert the PHP form records in my database and take advantage of the form validation nicely like in http://ecopethandbags.com/contactTest.php
    I am attaching the files.
    Thank you for you help!

    boloco wrote:
    My question is:
    How can I insert the PHP form records in my database and take advantage of the form validation nicely like in http://ecopethandbags.com/contactTest.php
    Use simple PHP logic to merge the scripts together.
    Dreamweaver automatically puts the Insert Record server behavior code at the top of the script. You need to adapt it so that the validation is done first. If the validation succeeds, use the Insert Record server behavior. If not, redisplay the form.
    if (array_key_exists('send', $_POST)) {
      // validate the form input
      if (!$suspect && empty($missing)) {
      // send the mail
        if ($mailSent) {
        unset($missing);
        // insert the Insert Record server behavior code here

  • JDEV Team: Strange behavior in TOMCAT using DATATAGS (VERY CRITICAL)

    I am encountering some strange behavior when I deploy my application to TOMCAT.
    If I run in JDeveloper (webtogo) everything works fine but the behavior changes completely in TOMCAT.
    Let me try and explain my situation here.
    I have 3 jsps :
    1.iss_listApps.jsp which is used to browse all the available records, allows the user to navigate to a specific record and edit or delete.
    2. app_edit.jsp which is used to edit/delete a specific row passed from iss_listApps.jsp.
    3. app_edit_post.jsp which is used to save the changes.
    Note that I use an anchor ">Edit</a> to pass a row from the browser page to the edit page.
    For your convenience I have listed all the source files below.
    Now here are my problems:
    Problem 1. If I run it in JDeveloper, I am able to browse the records and go to a specific record to edit and delete by clicking on the "Edit" anchor provided in the browser page.
    I can also go to the edit page and backout out of it by not saving the changes. In that case I am back in my browser page and I can again click on the "Edit" anchor to a specific record.
    However if I am in TOMCAT, I am able to browse and go to a specific record so long as I make changes to it and save it. If for any reason, I do not save a record and I go back to my browser
    page then any subsequent calls to to edit a specific record goes to the same OLD RECORD that I did not save.
    I fail to understand why? Maybe the "webtogo" server automatically refreshes when I click on the "back tab". If so, how do I automatically refresh a jsp page when I click on the "back tab" in TOMCAT.
    I would sincerely appreciate any help on this.
    Problem 2. I have an include jsp tag in my browser page. defined as
    <jsp:include page="Message.jsp" flush="true">
    <jsp:param name="colspan" value="2"/>
    </jsp:include>.
    This section of the code is currently commented out because if I uncomment it then it runs ok in JDeveloper but in Tomcat it causes the browser page to always navigate to the first record if I want to edit a specific record.
    I would sincerely appreciate any answer on this.
    Here are my source files:
    1. iss_ListApps.jsp (browser page). Please see how the anchor is formed. It causes no problems
    in JDeveloper.
    <%@ page contentType="text/html;charset=WINDOWS-1252"%>
    <HTML>
    <base target="contentsframe">
    <head>
    </head>
    <body>
    <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
    <jbo:ApplicationModule id="NewBC4J.NewBC4JModule" configname="NewBC4J.NewBC4JModule.NewBC4JModuleLocal" username="issue" password="issue"/>
    <jbo:RollBack appid="NewBC4J.NewBC4JModule" />
    <jbo:DataSource id="app_vo" appid="NewBC4J.NewBC4JModule" viewobject="ApplicationsView" ></jbo:DataSource>
    <jbo:RefreshDataSource datasource="app_vo" />
    <table width="100%" bgcolor="tan" border="0" align="center" cellpadding="3" cellspacing="0">
    <%--
    <jsp:include page="Message.jsp" flush="true">
    <jsp:param name="colspan" value="2"/>
    </jsp:include> --%>
    <form name="list" target="body" action="app_edit.jsp" method="post">
    <tr><th colspan="4">List of Valid Applications</th></tr>
    <tr>
    <th> </th>
    <th align="left"><u>Code</u></th>
    <th align="left"><u>Name</u></th>
    <th align="left"><u>Description</u></th>
    </tr>
    <tr>
    <jbo:RowsetIterate datasource="app_vo">
    <td>
    <a href="app_edit.jsp?RowKeyValue=<jbo:ShowValue datasource="app_vo" dataitem="RowKey"/>">Edit</a>
    </td>
    <td>
    <jbo:ShowValue datasource="app_vo" dataitem="Code" />
    </td>
    <td>
    <jbo:ShowValue datasource="app_vo" dataitem="Name" />
    </td>
    <td>
    <jbo:ShowValue datasource="app_vo" dataitem="A ppDesc" />
    </td>
    </tr>
    </jbo:RowsetIterate>
    </form>
    </table>
    <table width="100%" bgcolor="skyblue" align="center" cellpadding="10" cellspacing="0" >
    <tr>
    <form NAME="AddForm" action="app_add.jsp">
    <td>
    <input type = "submit" name="submit" value="Add" align="center" >
    </td>
    </form>
    </tr>
    </table>
    </body>
    <jbo:ReleasePageResources releasemode="Stateful" appid="NewBC4J.NewBC4JModule" />
    </html>
    2. Second Source File: app_edit.jsp (Allows editing of a record)
    <%@ page contentType="text/html;charset=WINDOWS-1252"%>
    <HTML>
    <base target="contentsframe">
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1252">
    <META NAME="GENERATOR" CONTENT="Oracle JDeveloper">
    <TITLE>
    </TITLE>
    </HEAD>
    <BODY>
    <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
    <jbo:ApplicationModule id="NewBC4J.NewBC4JModule" configname="NewBC4J.NewBC4JModule.NewBC4JModuleLocal" />
    <jbo:DataSource id="app_vo" appid="NewBC4J.NewBC4JModule" viewobject="ApplicationsView" />
    <jbo:Row id="myrow" datasource="app_vo" rowkeyparam="RowKeyValue" action="Find">
    <jbo:SetAttribute dataitem="*"/>
    </jbo:Row>
    <table width="100%" bgcolor="skyblue" border="0" align="center">
    <tr>
    <td>
    <table width="100%" bgcolor="tan" border="0" align="center" cellpadding="3" cellspacing="0">
    <form NAME="iForm" action="app_edit_post.jsp">
    <tr>
    <th colspan="2">
    "Edit/Delete Applications"
    </th>
    </tr>
    <jsp:include page="Message.jsp" flush="true">
    <jsp:param name="colspan" value="2"/>
    </jsp:include>
    <tr>
    <td align="right"><b><font color="red"> Name:</font></b></td>
    <td> <jbo:InputText datasource="app_vo" dataitem="Name" cols="50" />
    </td>
    </tr>
    <tr>
    <td align="Right"><b><font color="red"> Description: </font></b></td>
    <td> <jbo:InputTextArea datasource="app_vo" dataitem="AppDesc" cols="50" rows="5" />
    </td>
    </tr>
    </table>
    <!-- Create a table for the save and Delete Buttons -->
    <table width="100%" bgcolor="skyblue" align="center" cellpadding="10" cellspacing="0" >
    <tr>
    <input name="RowKeyValue" type="hidden" value="<jbo:ShowValue datasource="app_vo" dataitem="RowKey"/>" />
    <td>
    <input type = "submit" name="submit" value="Save">
    </td>
    </form>
    <form NAME="DelForm" action="app_del_post.jsp">
    <input name="RowKeyVal" type="hidden" value="<jbo:ShowValue datasource="app_vo" dataitem="RowKey"/>" />
    <td>
    <input type = "submit" name="submit" value="Delete">
    </td>
    </form>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </BODY>
    </HTML>
    <jbo:ReleasePageResources releasemode="Stateful" />
    3. Third source file app_edit_post.jsp (ALlows saving the changes made to a specific record)
    <%@ page contentType="text/html;charset=ISO-8859-1"%>
    <HTML>
    <BODY>
    <%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
    <jbo:ApplicationModule id="NewBC4J.NewBC4JModule" configname="NewBC4J.NewBC4JModule.NewBC4JModuleLocal" />
    <jbo:DataSource id="app_vo" appid="NewBC4J.NewBC4JModule" viewobject="ApplicationsView" ></jbo:DataSource>
    <%
    try
    %>
    <jbo:Row id="row3" datasource="app_vo" rowkeyparam="RowKeyValue" action="Update" >
    <jbo:SetAttribute dataitem="*" />
    </jbo:Row>
    <jbo:Commit appid="NewBC4J.NewBC4JModule" />
    <p><font face="Arial, Helvetica, sans-serif"><b><font color="006699">Application Successfully Updated</b></font></font> </p>
    <%
    catch(Exception exc)
    out.println("<pre> ");
    exc.printStackTrace(new java.io.PrintWriter(out));
    out.println("</pre>");
    %>
    <br>
    <br>
    <form action="app_ListApps.jsp" method="post"><input type="submit" value="Click to Continue"></form
    <jbo:ReleasePageResources releasemode="Stateful" />
    </BODY>
    </HTML>
    null

    I would not expect the 'back' button to automatically refresh the page. This button basically traverses the history of pages. Since Tomcat is caching your pages, you can try to control it's interaction with the browser by:
    1. Adding cache control pragmas to the returned content so it doesn't get cached.(look at www.w3c.org at the HTTP spec)
    2. dont rely on the back button, place a link on your pages to go back to the list page.
    3. change your cache control settings in your browser to check for a new page every time a url is visited.

  • Strange behavior: action method not called when button submitted

    Hello,
    My JSF app is diplaying a strange behavior: when the submit button is pressed the action method of my managed bean is not called.
    Here is my managed bean:
    package arcoiris;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.model.SelectItem;
    public class SearchManagedBean {
        //Collected from search form
        private String keyword;
        private String country;
        private int[] postcode;
        private boolean commentExists;
        private int rating;
        private boolean websiteExists;
        //Used to populate form
        private List<SelectItem> availableCountries;
        private List<SelectItem> availablePostcodes;
        private List<SelectItem> availableRatings;
        //Retrieved from ejb tier
        private List<EstablishmentLocal> retrievedEstablishments;
        //Service locator
        private arcoiris.ServiceLocator serviceLocator;
        //Constructor
        public SearchManagedBean() {
            System.out.println("within constructor SearchManagedBean");
            System.out.println("rating "+this.rating);
        //Getters and setters
        public String getKeyword() {
            return keyword;
        public void setKeyword(String keyword) {
            this.keyword = keyword;
        public String getCountry() {
            return country;
        public void setCountry(String country) {
            this.country = country;
        public boolean isCommentExists() {
            return commentExists;
        public void setCommentExists(boolean commentExists) {
            this.commentExists = commentExists;
        public int getRating() {
            return rating;
        public void setRating(int rating) {
            this.rating = rating;
        public boolean isWebsiteExists() {
            return websiteExists;
        public void setWebsiteExists(boolean websiteExists) {
            this.websiteExists = websiteExists;
        public List<SelectItem> getAvailableCountries() {
            List<SelectItem> countries = new ArrayList<SelectItem>();
            SelectItem si_1 = new SelectItem();
            SelectItem si_2 = new SelectItem();
            SelectItem si_3 = new SelectItem();
            si_1.setValue("2");
            si_1.setLabel("ecuador");
            si_2.setValue("1");
            si_2.setLabel("colombia");
            si_3.setValue("3");
            si_3.setLabel("peru");
            countries.add(si_1);
            countries.add(si_2);
            countries.add(si_3);
            return countries;
        public void setAvailableCountries(List<SelectItem> countries) {
            this.availableCountries = availableCountries;
        public List<SelectItem> getAvailablePostcodes() {
            List<SelectItem> postcodes = new ArrayList<SelectItem>();
            SelectItem si_1 = new SelectItem();
            SelectItem si_2 = new SelectItem();
            SelectItem si_3 = new SelectItem();
            si_1.setValue(75001);
            si_1.setLabel("75001");
            si_2.setValue(75002);
            si_2.setLabel("75002");
            si_3.setValue(75003);
            si_3.setLabel("75003");
            postcodes.add(si_1);
            postcodes.add(si_2);
            postcodes.add(si_3);
            return postcodes;
        public void setAvailablePostcodes(List<SelectItem> availablePostcodes) {
            this.availablePostcodes = availablePostcodes;
        public List<SelectItem> getAvailableRatings() {
            List<SelectItem> ratings = new ArrayList<SelectItem>();
            SelectItem si_1 = new SelectItem();
            SelectItem si_2 = new SelectItem();
            SelectItem si_3 = new SelectItem();
            si_1.setValue(1);
            si_1.setLabel("1");
            si_2.setValue(2);
            si_2.setLabel("2");
            si_3.setValue(3);
            si_3.setLabel("3");
            ratings.add(si_1);
            ratings.add(si_2);
            ratings.add(si_3);
            return ratings;
        public void setAvailableRatings(List<SelectItem> availableRatings) {
            this.availableRatings = availableRatings;
        public int[] getPostcode() {
            return postcode;
        public void setPostcode(int[] postcode) {
            this.postcode = postcode;
        public List<EstablishmentLocal> getRetrievedEstablishments() {
            return retrievedEstablishments;
        public void setRetrievedEstablishments(List<EstablishmentLocal> retrievedEstablishments) {
            this.retrievedEstablishments = retrievedEstablishments;
        //Business methods
        public String performSearch(){
            System.out.println("performSearchManagedBean begin");
            SearchRequestDTO searchRequestDto = new SearchRequestDTO(this.keyword,this.country,this.postcode,this.commentExists,this.rating, this.websiteExists);
            SearchSessionLocal searchSession = lookupSearchSessionBean();
            List<EstablishmentLocal> retrievedEstablishments = searchSession.performSearch(searchRequestDto);
            this.setRetrievedEstablishments(retrievedEstablishments);
            System.out.println("performSearchManagedBean end");
            return "success";
        private arcoiris.ServiceLocator getServiceLocator() {
            if (serviceLocator == null) {
                serviceLocator = new arcoiris.ServiceLocator();
            return serviceLocator;
        private arcoiris.SearchSessionLocal lookupSearchSessionBean() {
            try {
                return ((arcoiris.SearchSessionLocalHome) getServiceLocator().getLocalHome("java:comp/env/ejb/SearchSessionBean")).create();
            } catch(javax.naming.NamingException ne) {
                java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
                throw new RuntimeException(ne);
            } catch(javax.ejb.CreateException ce) {
                java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ce);
                throw new RuntimeException(ce);
    }Here is my jsp page:
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
             <html>
                 <head>
                     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                     <META HTTP-EQUIV="pragma" CONTENT="no-cache">
                     <title>JSP Page</title>
                 </head>
                 <body>
                     <f:view>
                         <h:panelGroup id="body">
                             <h:form id="searchForm">
                                 <h:panelGrid columns="2">
                                     <h:outputText id="keywordLabel" value="enter keyword"/>   
                                     <h:inputText id="keywordField" value="#{SearchManagedBean.keyword}"/>
                                     <h:outputText id="countryLabel" value="choose country"/>   
                                     <h:selectOneListbox id="countryField" value="#{SearchManagedBean.country}">
                                         <f:selectItems id="availableCountries" value="#{SearchManagedBean.availableCountries}"/>
                                     </h:selectOneListbox>
                                     <h:outputText id="postcodeLabel" value="choose postcode(s)"/>   
                                     <h:selectManyListbox id="postcodeField" value="#{SearchManagedBean.postcode}">
                                         <f:selectItems id="availablePostcodes" value="#{SearchManagedBean.availablePostcodes}"/>
                                     </h:selectManyListbox>
                                     <h:outputText id="commentExistsLabel" value="with comment"/>
                                     <h:selectBooleanCheckbox id="commentExistsField" value="#{SearchManagedBean.commentExists}" />
                                     <h:outputText id="ratingLabel" value="rating"/>
                                     <h:selectOneListbox id="ratingField" value="#{SearchManagedBean.rating}">
                                         <f:selectItems id="availableRatings" value="#{SearchManagedBean.availableRatings}"/>
                                     </h:selectOneListbox>
                                     <h:outputText id="websiteExistsLabel" value="with website"/>
                                     <h:selectBooleanCheckbox id="websiteExistsField" value="#{SearchManagedBean.websiteExists}" />
                                     <h:commandButton value="search" action="#{SearchManagedBean.performSearch}"/>
                                 </h:panelGrid>
                             </h:form>
                         </h:panelGroup>
                     </f:view>
                 </body>
             </html>
         here is my faces config file:
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE faces-config PUBLIC
      "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
      "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
        <managed-bean>
            <managed-bean-name>SearchManagedBean</managed-bean-name>
            <managed-bean-class>arcoiris.SearchManagedBean</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <navigation-rule>
           <description></description>
            <from-view-id>/welcomeJSF.jsp</from-view-id>
            <navigation-case>
            <from-outcome>success</from-outcome>
            <to-view-id>index.jsp</to-view-id>
            </navigation-case>
        </navigation-rule>
    </faces-config>The problem occurs when the field ratingField is left blank (which amounts to it being set at 0 since it is an int).
    Can anyone help please?
    Thanks in advance,
    Julien.

    Hello,
    Thanks for the suggestion. I added the tag and it now says:
    java.lang.IllegalArgumentException
    I got that from the log:
    2006-08-17 15:29:16,859 DEBUG [com.sun.faces.el.ValueBindingImpl] setValue Evaluation threw exception:
    java.lang.IllegalArgumentException
         at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.faces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:178)
         at com.sun.faces.el.impl.ArraySuffix.setValue(ArraySuffix.java:192)
         at com.sun.faces.el.impl.ComplexValue.setValue(ComplexValue.java:171)
         at com.sun.faces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:234)
         at javax.faces.component.UIInput.updateModel(UIInput.java:544)
         at javax.faces.component.UIInput.processUpdates(UIInput.java:442)
         at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:935)
         at javax.faces.component.UIForm.processUpdates(UIForm.java:196)
         at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:935)
         at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:935)
         at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:363)
         at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:81)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Thread.java:595)
    2006-08-17 15:29:16,875 DEBUG [com.sun.faces.context.FacesContextImpl] Adding Message[sourceId=searchForm:ratingField,summary=java.lang.IllegalArgumentException)Do you see where the problem comes from??
    Julien.

  • Strange behavior in audio editing

    Greetings,  I am working on a progect in logic x and am suddenly having difficulty editing audio.  There is behaviour that I do not understatnd-  If I use the trim tool, other regions move (I am editing a large piece, using group to edit all regions at the same time).  Also after an edit, there is audio playing from some previous edit or from a track that is overlapped or something?  I have toggled the overlap/ no overlap function and have been working with shuffle modes, but now it seems strange.  Do I have something set differently or wrong I wonder.
    Thanks for the help!
    cheers---

    I did a quick (and dirty) fix for this, but it has one problem. After this handler has blocked the submit, you can only enter edit mode using the edit-button at ribbon. Edit button at upper right corner stops to work for some reason. After site refresh everything
    works again, so not a major issue.
    <script>
    // SharePoint input element bug handler
    // More bug: http://social.technet.microsoft.com/Forums/sharepoint/en-US/33df42ba-00b3-41a8-8fb9-f8187cfc216d/strange-behavior-in-firefox-input-text-with-enter-opens-page-for-editing?forum=sharepointgeneralprevious
    // This fix stops form submit => blocks transfer to edit mode
    var disableFormSubmitDueToBug = false;
    var bugSubmitHandlerAttached = false;
    $('*selector for inputs here*').keydown(function(e){
    if(e.keyCode == 13 ) { 
      disableFormSubmitDueToBug = true;
      bindBugSubmitHandler();
    } else {
      unbindBugSubmitHandler();
    }).focusout(function(){
    unbindBugSubmitHandler();
    function bindBugSubmitHandler(){
    $( "form" ).bind("submit", function( e ) {
    if(disableFormSubmitDueToBug) {
    e.preventDefault();
    console.log('Blocked submit by SP bug handler');
    bugSubmitHandlerAttached = true;
    function unbindBugSubmitHandler(){
    if(bugSubmitHandlerAttached){
    $( "form" ).unbind("submit");
    bugSubmitHandlerAttached = false;
    console.log('SP bug submit handler unbind occurred');
    </script>
    Thank you SO much for writing this script. It worked for me.
    Where the code says: $('*selector for inputs here*').keydown(function(e){
    You need to replace *selector or inputs here* with the name of your input box, so for me it was:
    $("input[name^='client_name']").keydown(function(e){

Maybe you are looking for

  • Cannot create a large hardcover book in iphoto '08

    I'm trying to create a large (8.5 x 11) hardcover book in iphoto. I've followed all of the directions (selecting the album, selecting "book" and then selecting the size and theme but nothing happens. The only book that I seem to be able to create is

  • T430s Takes Several Minutes to Shut Down

    Hey all, I've got a T430s running Windows 8.1. The machine runs great and boots very fast (probably helps that I bought an SSD); however, when I shut down, it takes several minutes (5+ minutes) to fully power-down. The screen goes black, but USB devi

  • Purchased acrobat pro but keeps defaulting to adobe reader

    Purchased Acrobat Pro but keeps defaulting to Adobe Reader

  • SP3 Installation Issues

    Hey all, I've been trying multiple times to upgrade from XCelsus SP 1 to SP3 with nothing but headaches.  I downloaded Pressent SP3 and found that the flash data connections weren't working.  When I added a connection the preferences and binding info

  • Some sites are not navigable

    Why are some sites so difficult to navigate.  Trying to book airline tickets with Easyjet but cannot complete the booking as the BOOK NOW button is overlaid with text and unusable.  Tried using keyboard instead of pad or house and still no luck.  Hav