ValueClass?

This is what I used and it failed. I wish the error would be more helpful.

HiddenField serviceId = new HiddenField();
serviceId.setName("serviceId");
form.add(serviceId).setRequired(true);

My grandmother used to say that you eat a sack of salt with a man (a spouse
that is) and still don't know him. I suppose there is always something to
learn about a framework.

Your suggestion worked. Thank you for not belittling stupid questions.

I am back using my nights for hacking away. Construction is so bad I barely
have any work so now I am building a website geared toward finding
remodeling jobs and sharing referral with contractors. I will post it when
done.

Is there a reason we still cannot do method chaining yet:

new NumberField().setName("myfield").setWidth(300).setWhatever().add(new
SomeController() {});

These setters return void anyways and I don't see any backward compatibility
issues. This chaining makes coding cursive, less disruptive or verbose.

Thanks again.


sabob wrote:
> 
> Hi Florin,
> 
> Looks like the HiddenField valueClass is null.
> 
> How do you construct the hidden field on the Java side?
> 
> For example if you would like to specify a hidden field containing a 
> Long it would be like this:
> 
> HiddenField field = new HiddenField("servereId", Long.class);
> 
> or
> 
> HiddenField field = new HiddenField("servereId", 1234L);
> 
> 
> bob
> 
> 
> florin.g wrote:
>> Unless I get something wrong, we have a showstopper.
>> 
>> I prefer manual layout of forms. I do start with $form at first for
>> practical reasons and once the functionality is working fine I switch to
>> manual layout.
>> 
>> There is one hidden field, <input type="hidden" name="serviceId"
>> id="webform_serviceId"/> that I cut from the $form output and place it in
>> my
>> manual form. No errors. When the value is set via javascript and then
>> submit, I get an error. If I don't set the value, there is no error. If I
>> set the value manually (hard coded), it still does not work. 
>> 
>> Here's the error:
>> 
>> java.lang.NullPointerException
>>      at java.lang.Class.isAssignableFrom(Native Method)
>>      at
>> net.sf.click.control.HiddenField.bindRequestValue(HiddenField.java:282)
>>      at net.sf.click.control.Field.onProcess(Field.java:873)
>>      at net.sf.click.control.Form.onProcess(Form.java:1746)
>>      at net.sf.click.ClickServlet.processPage(ClickServlet.java:546)
>>      at net.sf.click.ClickServlet.handleRequest(ClickServlet.java:331)
>>      at net.sf.click.ClickServlet.doPost(ClickServlet.java:267)
>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>>      at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
>>      at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1120)
>>      at
>> net.sf.click.extras.filter.PerformanceFilter.doFilter(PerformanceFilter.java:290)
>>      at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1111)
>>      at main.XSS$$M$7513a72f.doFilter(XSS.java:25)
>>      at main.XSS$$A$7513a72f.doFilter(<generated>)
>>      at main.XSS.doFilter(<generated>)
>>      at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1111)
>>      at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>>      at
>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:219)
>>      at
>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>      at
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:786)
>>      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:431)
>>      at
>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:188)
>>      at
>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:113)
>>      at
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>      at org.mortbay.jetty.Server.handle(Server.java:325)
>>      at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:533)
>>      at
>> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:870)
>>      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:657)
>>      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>>      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:391)
>>      at
>> org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:235)
>>      at
>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:497)
>> 
>> It looks like it's happening here:
>> 
>> } else if (Date.class.isAssignableFrom(valueClass)) { // line 286 in
>> HiddenField.java
>>                 long time = Long.parseLong(aValue);
>>                 setValueObject(new Date(time));
>> 
>> }
>> 
>> I cannot get around it. If I switch the field value from value='110' to
>> value='_110' thinking that it's a matter of parsing a number, I get the
>> same
>> result.
>> 
>> I would think that it is easy to replicate in different environments.
>> 
>> Thanks. 
>> 
>> 
> 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Hidden-fields-do-not-post--tp1475339p1478425.html
Sent from the click-user mailing list archive at Nabble.com.

Reply via email to