[ 
https://issues.apache.org/jira/browse/TAPESTRY-2278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582487#action_12582487
 ] 

Sven Homburg commented on TAPESTRY-2278:
----------------------------------------

i am back ;-)
i think this little sample shows my problem

rendered by tap5 (here symplified):
<select id="mySelect" 
onChange="location=/mts/freightorder/edit.inputcustomer:change">
  <option value=""></option>
  <option value="1">customer 1</option>
  <option value="2">customer 2</option>
  <option value="3">customer 3</option>
</select>

page class (partial):

    @OnEvent(component = "inputCustomer", value = "change")
    JSONObject customerSelected(Long value)
    {
        JSONObject json = new JSONObject();
        json.put("found", false);

        if (value != null)
        {
            Customer customer = (Customer) 
getDAO(Customer.class).doRetrieve(value, false);
            if (customer != null)
            {
                json.put("found", true);
                json.put("street", customer.getAddress().getStreet());
                json.put("location", customer.getAddress().getZip() + " " + 
customer.getAddress().getCity());
                json.put("phone", customer.getAddress().getPhone1());
                json.put("fax", customer.getAddress().getFax1());
                json.put("email", customer.getAddress().getEmail1());

                _entity.setCustomer(customer);
            }
        }

        return json;
    }

if user choices the blank option tapestry throws an NFE.
if i could set the blank option value to "0", so i can react in this event 
method



> BlankOption value in Select component should be configurable
> ------------------------------------------------------------
>
>                 Key: TAPESTRY-2278
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2278
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.0.11
>            Reporter: Sven Homburg
>             Fix For: 5.0.12
>
>
> i often use the option value of a select component holding id's for database 
> entities.
> the id's type are most numeric values, so my problem is: 
> i attached an ajax request that sends each change from the select component.
> the following method catch the event
>     @OnEvent(component = "inputProject", value = "change")
>     JSONValue projectIdChanged(long projectId)
>     {
>        .....
>         return mapper.toJSON(resultList);
>     }
> if the user select the blank option
> the component throws a NumberFormatException
> so it were cool, if i declare the empty option value by my self.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to