Re: Submit form after disabling an input element via javascript?

2014-06-11 Thread Karl Kildén
Thanks Leo interesting points.

Imo if you have a security issue with a field being disabled then you have
a really weird app imo.

If JSF was used to define disabled then javascript hacks needs to be
prevented but if disabled was never set then I can't think of a use case
where it would be a risk if the client was allowed to disable it.

Also I wonder if myfaces even works like this consistently across
components and 2.x versions? I will test it a little more tomorrow I think.


On 10 June 2014 22:55, Howard W. Smith, Jr. smithh032...@gmail.com wrote:

 On Tue, Jun 10, 2014 at 4:38 PM, Leonardo Uribe lu4...@gmail.com wrote:

  The thing to remember here is never trust on the client.
  No matter how intelligent we want the client to be, in cases like this
 one
  the state on the server is the king, and that will not change (because we
  can't!).
 

 and this is what we are here for and this is the reason why we love Java
 'State' Faces, I mean Java 'Server' Faces... or Java State-on-Server Faces.
 the UI is maintained on the server... client is just a UI or presentation
 of what is maintained on server. :)



Re: Submit form after disabling an input element via javascript?

2014-06-10 Thread Howard W. Smith, Jr.
Leonardo, what are your thoughts on this thread? thanks.



On Wed, Jun 4, 2014 at 11:43 AM, Karl Kildén karl.kil...@gmail.com wrote:

 Howard,

 To do that one would need a purpose. I fail to see the benefit other than
 bending the knee to a JSF limitation.




 On 4 June 2014 16:48, Howard W. Smith, Jr. smithh032...@gmail.com wrote:

  Karl, if Javascript was written to enable field, why is there not
  Javascript to disable before submit?
  On Jun 4, 2014 8:33 AM, Karl Kildén karl.kil...@gmail.com wrote:
 
   Hi,
  
   my app recently upgraded from JSF 1.2 had a broken page with this in
 the
   log:
  
   WARNING: There should always be a submitted value for an input if it is
   rendered, its form is submitted, and it was not originally rendered
   disabled or read-only.  You cannot submit a form after disab
   ling an input element via javascript.  Consider setting read-only to
 true
   instead or resetting the disabled value back to false prior to form
   submission. Component : {Component-Path : [Class: javax.fa
   ces.component.UIViewRoot,ViewId: /pages/main.xhtml][Class:
   javax.faces.component.html.HtmlBody,Id: j_id_10][Class:
   javax.faces.component.html.HtmlForm,Id: f][Class:
   javax.faces.component.html.HtmlPane
   lGroup,Id: body][Class: javax.faces.component.html.HtmlPanelGroup,Id:
   contentBody][Class: javax.faces.component.html.HtmlPanelGrid,Id:
   j_id_2b_p][Class: javax.faces.component.html.HtmlInputText,Id: im
   portName] Location: /WEB-INF/facelets/admin/profileUploadForm.xhtml at
  line
   88 and column 73}
  
  
   I don't understand this limitation. Is there some global flag I could
 use
   to make sure not included inputs are seen as unchanged or something?
  
   cheers
  
 



Re: Submit form after disabling an input element via javascript?

2014-06-10 Thread Karl Kildén
Howard, thanks for the links and interest.

In my case I already rewrote all my pages but I still think that error
message is wrong.

This is our use case:

[X] Use Defaults for everything

Once the user unclicks that checkbox 5 inputs are editable otherwise they
get default. Since they get default I obviously just want JSF to leave me
alone and you know behave like they are disabled ;)

That way String fileName =newFile.txt; will not be changed and everything
is smooth.

What I see others complain about is that they have updated the value and
then disabled yet still want it posted. This is a fundamental
misunderstanding of how disabled works and differs from my scenario.

In my case there was no reason to do it with javascript though and I did
not like the solution in place so I fixed it by using f:ajax and
disabled=#{condition} but had it been a central part of my system I would
have been more hesitant to use the server side for such a simple operation.



On 10 June 2014 21:51, Howard W. Smith, Jr. smithh032...@gmail.com wrote:

 Leonardo, what are your thoughts on this thread? thanks.



 On Wed, Jun 4, 2014 at 11:43 AM, Karl Kildén karl.kil...@gmail.com
 wrote:

  Howard,
 
  To do that one would need a purpose. I fail to see the benefit other than
  bending the knee to a JSF limitation.
 
 
 
 
  On 4 June 2014 16:48, Howard W. Smith, Jr. smithh032...@gmail.com
 wrote:
 
   Karl, if Javascript was written to enable field, why is there not
   Javascript to disable before submit?
   On Jun 4, 2014 8:33 AM, Karl Kildén karl.kil...@gmail.com wrote:
  
Hi,
   
my app recently upgraded from JSF 1.2 had a broken page with this in
  the
log:
   
WARNING: There should always be a submitted value for an input if it
 is
rendered, its form is submitted, and it was not originally rendered
disabled or read-only.  You cannot submit a form after disab
ling an input element via javascript.  Consider setting read-only to
  true
instead or resetting the disabled value back to false prior to form
submission. Component : {Component-Path : [Class: javax.fa
ces.component.UIViewRoot,ViewId: /pages/main.xhtml][Class:
javax.faces.component.html.HtmlBody,Id: j_id_10][Class:
javax.faces.component.html.HtmlForm,Id: f][Class:
javax.faces.component.html.HtmlPane
lGroup,Id: body][Class: javax.faces.component.html.HtmlPanelGroup,Id:
contentBody][Class: javax.faces.component.html.HtmlPanelGrid,Id:
j_id_2b_p][Class: javax.faces.component.html.HtmlInputText,Id: im
portName] Location: /WEB-INF/facelets/admin/profileUploadForm.xhtml
 at
   line
88 and column 73}
   
   
I don't understand this limitation. Is there some global flag I could
  use
to make sure not included inputs are seen as unchanged or something?
   
cheers
   
  
 



Re: Submit form after disabling an input element via javascript?

2014-06-10 Thread Leonardo Uribe
Hi

This is something complicated. If you disable a link on the server, you
don't want a javascript that enable it on the client side, submit it and
then found that something that you don't expect has happended on the
server, right?. Who manage disable attribute? The client or the server?
If an action is performed on the server, the server manage the attribute,
so an Ajax request is mandatory to enable the input. Otherwise it could be
a security hole. The thing to remember here is never trust on the client.
No matter how intelligent we want the client to be, in cases like this one
the state on the server is the king, and that will not change (because we
can't!).

Regards,

Leonardo
On Jun 10, 2014 10:06 PM, Karl Kildén karl.kil...@gmail.com wrote:

 Howard, thanks for the links and interest.

 In my case I already rewrote all my pages but I still think that error
 message is wrong.

 This is our use case:

 [X] Use Defaults for everything

 Once the user unclicks that checkbox 5 inputs are editable otherwise they
 get default. Since they get default I obviously just want JSF to leave me
 alone and you know behave like they are disabled ;)

 That way String fileName =newFile.txt; will not be changed and everything
 is smooth.

 What I see others complain about is that they have updated the value and
 then disabled yet still want it posted. This is a fundamental
 misunderstanding of how disabled works and differs from my scenario.

 In my case there was no reason to do it with javascript though and I did
 not like the solution in place so I fixed it by using f:ajax and
 disabled=#{condition} but had it been a central part of my system I would
 have been more hesitant to use the server side for such a simple operation.



 On 10 June 2014 21:51, Howard W. Smith, Jr. smithh032...@gmail.com
 wrote:

  Leonardo, what are your thoughts on this thread? thanks.
 
 
 
  On Wed, Jun 4, 2014 at 11:43 AM, Karl Kildén karl.kil...@gmail.com
  wrote:
 
   Howard,
  
   To do that one would need a purpose. I fail to see the benefit other
 than
   bending the knee to a JSF limitation.
  
  
  
  
   On 4 June 2014 16:48, Howard W. Smith, Jr. smithh032...@gmail.com
  wrote:
  
Karl, if Javascript was written to enable field, why is there not
Javascript to disable before submit?
On Jun 4, 2014 8:33 AM, Karl Kildén karl.kil...@gmail.com wrote:
   
 Hi,

 my app recently upgraded from JSF 1.2 had a broken page with this
 in
   the
 log:

 WARNING: There should always be a submitted value for an input if
 it
  is
 rendered, its form is submitted, and it was not originally rendered
 disabled or read-only.  You cannot submit a form after disab
 ling an input element via javascript.  Consider setting read-only
 to
   true
 instead or resetting the disabled value back to false prior to form
 submission. Component : {Component-Path : [Class: javax.fa
 ces.component.UIViewRoot,ViewId: /pages/main.xhtml][Class:
 javax.faces.component.html.HtmlBody,Id: j_id_10][Class:
 javax.faces.component.html.HtmlForm,Id: f][Class:
 javax.faces.component.html.HtmlPane
 lGroup,Id: body][Class:
 javax.faces.component.html.HtmlPanelGroup,Id:
 contentBody][Class: javax.faces.component.html.HtmlPanelGrid,Id:
 j_id_2b_p][Class: javax.faces.component.html.HtmlInputText,Id: im
 portName] Location: /WEB-INF/facelets/admin/profileUploadForm.xhtml
  at
line
 88 and column 73}


 I don't understand this limitation. Is there some global flag I
 could
   use
 to make sure not included inputs are seen as unchanged or
 something?

 cheers

   
  
 



Re: Submit form after disabling an input element via javascript?

2014-06-10 Thread Howard W. Smith, Jr.
On Tue, Jun 10, 2014 at 4:38 PM, Leonardo Uribe lu4...@gmail.com wrote:

 The thing to remember here is never trust on the client.
 No matter how intelligent we want the client to be, in cases like this one
 the state on the server is the king, and that will not change (because we
 can't!).


and this is what we are here for and this is the reason why we love Java
'State' Faces, I mean Java 'Server' Faces... or Java State-on-Server Faces.
the UI is maintained on the server... client is just a UI or presentation
of what is maintained on server. :)


Re: Submit form after disabling an input element via javascript?

2014-06-08 Thread Howard W. Smith, Jr.
Karl,

http://stackoverflow.com/questions/10021634/jsf-when-disable-component-its-value-does-not-make-into-the-request-map-parame

see the question and BalusC's answer, please.



On Wed, Jun 4, 2014 at 11:43 AM, Karl Kildén karl.kil...@gmail.com wrote:

 Howard,

 To do that one would need a purpose. I fail to see the benefit other than
 bending the knee to a JSF limitation.




 On 4 June 2014 16:48, Howard W. Smith, Jr. smithh032...@gmail.com wrote:

  Karl, if Javascript was written to enable field, why is there not
  Javascript to disable before submit?
  On Jun 4, 2014 8:33 AM, Karl Kildén karl.kil...@gmail.com wrote:
 
   Hi,
  
   my app recently upgraded from JSF 1.2 had a broken page with this in
 the
   log:
  
   WARNING: There should always be a submitted value for an input if it is
   rendered, its form is submitted, and it was not originally rendered
   disabled or read-only.  You cannot submit a form after disab
   ling an input element via javascript.  Consider setting read-only to
 true
   instead or resetting the disabled value back to false prior to form
   submission. Component : {Component-Path : [Class: javax.fa
   ces.component.UIViewRoot,ViewId: /pages/main.xhtml][Class:
   javax.faces.component.html.HtmlBody,Id: j_id_10][Class:
   javax.faces.component.html.HtmlForm,Id: f][Class:
   javax.faces.component.html.HtmlPane
   lGroup,Id: body][Class: javax.faces.component.html.HtmlPanelGroup,Id:
   contentBody][Class: javax.faces.component.html.HtmlPanelGrid,Id:
   j_id_2b_p][Class: javax.faces.component.html.HtmlInputText,Id: im
   portName] Location: /WEB-INF/facelets/admin/profileUploadForm.xhtml at
  line
   88 and column 73}
  
  
   I don't understand this limitation. Is there some global flag I could
 use
   to make sure not included inputs are seen as unchanged or something?
  
   cheers
  
 



Re: Submit form after disabling an input element via javascript?

2014-06-08 Thread Howard W. Smith, Jr.
Another similar (really old) discussion where BalusC responded on the topic
in 2009.

https://community.oracle.com/thread/1719243?start=0tstart=0




On Sun, Jun 8, 2014 at 6:34 AM, Howard W. Smith, Jr. smithh032...@gmail.com
 wrote:

 Karl,


 http://stackoverflow.com/questions/10021634/jsf-when-disable-component-its-value-does-not-make-into-the-request-map-parame

 see the question and BalusC's answer, please.



 On Wed, Jun 4, 2014 at 11:43 AM, Karl Kildén karl.kil...@gmail.com
 wrote:

 Howard,

 To do that one would need a purpose. I fail to see the benefit other than
 bending the knee to a JSF limitation.




 On 4 June 2014 16:48, Howard W. Smith, Jr. smithh032...@gmail.com
 wrote:

  Karl, if Javascript was written to enable field, why is there not
  Javascript to disable before submit?
  On Jun 4, 2014 8:33 AM, Karl Kildén karl.kil...@gmail.com wrote:
 
   Hi,
  
   my app recently upgraded from JSF 1.2 had a broken page with this in
 the
   log:
  
   WARNING: There should always be a submitted value for an input if it
 is
   rendered, its form is submitted, and it was not originally rendered
   disabled or read-only.  You cannot submit a form after disab
   ling an input element via javascript.  Consider setting read-only to
 true
   instead or resetting the disabled value back to false prior to form
   submission. Component : {Component-Path : [Class: javax.fa
   ces.component.UIViewRoot,ViewId: /pages/main.xhtml][Class:
   javax.faces.component.html.HtmlBody,Id: j_id_10][Class:
   javax.faces.component.html.HtmlForm,Id: f][Class:
   javax.faces.component.html.HtmlPane
   lGroup,Id: body][Class: javax.faces.component.html.HtmlPanelGroup,Id:
   contentBody][Class: javax.faces.component.html.HtmlPanelGrid,Id:
   j_id_2b_p][Class: javax.faces.component.html.HtmlInputText,Id: im
   portName] Location: /WEB-INF/facelets/admin/profileUploadForm.xhtml at
  line
   88 and column 73}
  
  
   I don't understand this limitation. Is there some global flag I could
 use
   to make sure not included inputs are seen as unchanged or something?
  
   cheers
  
 





Re: Submit form after disabling an input element via javascript?

2014-06-04 Thread Howard W. Smith, Jr.
Karl, if Javascript was written to enable field, why is there not
Javascript to disable before submit?
On Jun 4, 2014 8:33 AM, Karl Kildén karl.kil...@gmail.com wrote:

 Hi,

 my app recently upgraded from JSF 1.2 had a broken page with this in the
 log:

 WARNING: There should always be a submitted value for an input if it is
 rendered, its form is submitted, and it was not originally rendered
 disabled or read-only.  You cannot submit a form after disab
 ling an input element via javascript.  Consider setting read-only to true
 instead or resetting the disabled value back to false prior to form
 submission. Component : {Component-Path : [Class: javax.fa
 ces.component.UIViewRoot,ViewId: /pages/main.xhtml][Class:
 javax.faces.component.html.HtmlBody,Id: j_id_10][Class:
 javax.faces.component.html.HtmlForm,Id: f][Class:
 javax.faces.component.html.HtmlPane
 lGroup,Id: body][Class: javax.faces.component.html.HtmlPanelGroup,Id:
 contentBody][Class: javax.faces.component.html.HtmlPanelGrid,Id:
 j_id_2b_p][Class: javax.faces.component.html.HtmlInputText,Id: im
 portName] Location: /WEB-INF/facelets/admin/profileUploadForm.xhtml at line
 88 and column 73}


 I don't understand this limitation. Is there some global flag I could use
 to make sure not included inputs are seen as unchanged or something?

 cheers



Re: Submit form after disabling an input element via javascript?

2014-06-04 Thread Karl Kildén
Howard,

To do that one would need a purpose. I fail to see the benefit other than
bending the knee to a JSF limitation.




On 4 June 2014 16:48, Howard W. Smith, Jr. smithh032...@gmail.com wrote:

 Karl, if Javascript was written to enable field, why is there not
 Javascript to disable before submit?
 On Jun 4, 2014 8:33 AM, Karl Kildén karl.kil...@gmail.com wrote:

  Hi,
 
  my app recently upgraded from JSF 1.2 had a broken page with this in the
  log:
 
  WARNING: There should always be a submitted value for an input if it is
  rendered, its form is submitted, and it was not originally rendered
  disabled or read-only.  You cannot submit a form after disab
  ling an input element via javascript.  Consider setting read-only to true
  instead or resetting the disabled value back to false prior to form
  submission. Component : {Component-Path : [Class: javax.fa
  ces.component.UIViewRoot,ViewId: /pages/main.xhtml][Class:
  javax.faces.component.html.HtmlBody,Id: j_id_10][Class:
  javax.faces.component.html.HtmlForm,Id: f][Class:
  javax.faces.component.html.HtmlPane
  lGroup,Id: body][Class: javax.faces.component.html.HtmlPanelGroup,Id:
  contentBody][Class: javax.faces.component.html.HtmlPanelGrid,Id:
  j_id_2b_p][Class: javax.faces.component.html.HtmlInputText,Id: im
  portName] Location: /WEB-INF/facelets/admin/profileUploadForm.xhtml at
 line
  88 and column 73}
 
 
  I don't understand this limitation. Is there some global flag I could use
  to make sure not included inputs are seen as unchanged or something?
 
  cheers