RE: Help: Ignore validation and still update model?

2006-06-12 Thread Jesse Alexander \(KSFD 121\)
Usecases like this inspired Mike and me to create the
OtionalValidator-stuff
(http://wiki.apache.org/myfaces/OptionalValidationFramework) BUT it
only
works well when you are using facelets... (the pure 1.1 lifecycle is a
major PITA for this kind of processing...)

In your case the add and delete buttons would carry the soft 
flag to the validation... and the register and save buttons the
hard flag...

hth
Alexander

PS: The usability of this component or its alternatives are also on
my todo-list...
PS2: Usually I try to be on the IRC-channels  sometimes a week... (nick:
AJesse)



 -Original Message-
 From: Andrew Robinson [mailto:[EMAIL PROTECTED] 
 Sent: Monday, June 12, 2006 1:41 AM
 To: MyFaces Discussion
 Subject: Help: Ignore validation and still update model?
 
 Okay, I am having an issue for a non-standard configuration (go
 figure, I think I am in the 20% just about 80% of the time) and am
 looking for help.
 
 I think what I have to do is continue to the update model phase even
 when validation fails, but I'll tell you what I am doing in case
 anyone has a better idea.
 
 I have a register user form. It has three child tables (t:dataTable)
 one for each of: email addresses, phone numbers and geographic
 addresses. I have done it this way so that the user can enter multiple
 emails, phone numbers and addresses (for example, a work phone, a cell
 phone, etc). These tables are backed by Hibernate configured lists (so
 I have a FK child tables to store these records for the user table).
 
 In my view, I have Add and Delete buttons for the tables (and rows
 in the table). I don't care when the user clicks and add or a delete
 if components are invalid within the page (I only care when they click
 the Register for new users or Save for existing users).
 
 I tried marking the command links as immediate, but as those familiar
 with JSF would know, opened a can of worms. Since data tables do not
 support submitted values in child components, the user's data from the
 data tables disappeared when the view was re-rendered. So a no-go
 there.
 
 So I really need the update model phase to complete. (Yes one solution
 would be to enable AJAX for this project and only refresh the table
 row for the add or the delete, but that is beyond my scope for this
 project).
 
 Is there a way to let validation happen, but regardless of validation
 errors and warnings, to go ahead and update the model and execute the
 action?
 
 I suppose I could use a sub-form from the sandbox, but would that not
 cause the input fields in the other tables to loose their values
 anyways since validate and updating of the model does not take place
 for non-subform fields (I haven't tried the sub form out yet although
 it sounds like a good idea)?
 
 Another option may be to use a custom component that would update the
 value during the validation phase, but not stop the life cycle (so
 that the validation still occurs, and the values would still be kept
 for data table rows). I think that will work (didn't think it through
 fully yet), but it is messy (Basically a commandLink that doesn't use
 ActionEvent, but a custom event that does it's work during broadcast
 of process validators or apply request values).
 
 Anyone have a bright idea to get around this solution?
 
 Thank you
 -Andrew
 
 PS - also is there any way without partial page refreshing that
 inputSecret fields can not loose their value when the view is
 re-rendered (maybe by sending a static fake value down to the client
 that says to use the last value and then store that last value in
 the user's session?)?
 


Re: Help: Ignore validation and still update model?

2006-06-12 Thread Andrew Robinson

Okay, question about this. How can arguments be passed to child validators.

At first I thought the usage was:
jsfcomp:optionalValidator
f:validateLength minimum=4 maximum=25 /
/jsfcomp:optionalValidator


Causes an error as the validator only seems to work with validator
IDs, not validator tags.

Is this true?

How should I perform the above validation?

Also, requiredValidator is not in the taglib.xml, was there a reason for this?

Thanks,
Andrew

On 6/12/06, Jesse Alexander (KSFD 121)
[EMAIL PROTECTED] wrote:

Usecases like this inspired Mike and me to create the
OtionalValidator-stuff
(http://wiki.apache.org/myfaces/OptionalValidationFramework) BUT it
only
works well when you are using facelets... (the pure 1.1 lifecycle is a
major PITA for this kind of processing...)

In your case the add and delete buttons would carry the soft
flag to the validation... and the register and save buttons the
hard flag...

hth
Alexander

PS: The usability of this component or its alternatives are also on
my todo-list...
PS2: Usually I try to be on the IRC-channels  sometimes a week... (nick:
AJesse)



 -Original Message-
 From: Andrew Robinson [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 12, 2006 1:41 AM
 To: MyFaces Discussion
 Subject: Help: Ignore validation and still update model?

 Okay, I am having an issue for a non-standard configuration (go
 figure, I think I am in the 20% just about 80% of the time) and am
 looking for help.

 I think what I have to do is continue to the update model phase even
 when validation fails, but I'll tell you what I am doing in case
 anyone has a better idea.

 I have a register user form. It has three child tables (t:dataTable)
 one for each of: email addresses, phone numbers and geographic
 addresses. I have done it this way so that the user can enter multiple
 emails, phone numbers and addresses (for example, a work phone, a cell
 phone, etc). These tables are backed by Hibernate configured lists (so
 I have a FK child tables to store these records for the user table).

 In my view, I have Add and Delete buttons for the tables (and rows
 in the table). I don't care when the user clicks and add or a delete
 if components are invalid within the page (I only care when they click
 the Register for new users or Save for existing users).

 I tried marking the command links as immediate, but as those familiar
 with JSF would know, opened a can of worms. Since data tables do not
 support submitted values in child components, the user's data from the
 data tables disappeared when the view was re-rendered. So a no-go
 there.

 So I really need the update model phase to complete. (Yes one solution
 would be to enable AJAX for this project and only refresh the table
 row for the add or the delete, but that is beyond my scope for this
 project).

 Is there a way to let validation happen, but regardless of validation
 errors and warnings, to go ahead and update the model and execute the
 action?

 I suppose I could use a sub-form from the sandbox, but would that not
 cause the input fields in the other tables to loose their values
 anyways since validate and updating of the model does not take place
 for non-subform fields (I haven't tried the sub form out yet although
 it sounds like a good idea)?

 Another option may be to use a custom component that would update the
 value during the validation phase, but not stop the life cycle (so
 that the validation still occurs, and the values would still be kept
 for data table rows). I think that will work (didn't think it through
 fully yet), but it is messy (Basically a commandLink that doesn't use
 ActionEvent, but a custom event that does it's work during broadcast
 of process validators or apply request values).

 Anyone have a bright idea to get around this solution?

 Thank you
 -Andrew

 PS - also is there any way without partial page refreshing that
 inputSecret fields can not loose their value when the view is
 re-rendered (maybe by sending a static fake value down to the client
 that says to use the last value and then store that last value in
 the user's session?)?




Re: Help: Ignore validation and still update model?

2006-06-11 Thread Murat Hazer
AFAIK to exceute update model phase you can call processUpdate(facesContext) func. in the validator method ie:public void validateAddress(FacesContext facesContext,   UIComponent component, Object objectToValidate)
   throws ValidatorException {  ...  this.addressModel.processUpdates(facesContext); .}regardsOn 6/12/06, 
Andrew Robinson [EMAIL PROTECTED] wrote:
Okay, I am having an issue for a non-standard configuration (gofigure, I think I am in the 20% just about 80% of the time) and amlooking for help.I think what I have to do is continue to the update model phase even
when validation fails, but I'll tell you what I am doing in caseanyone has a better idea.I have a register user form. It has three child tables (t:dataTable)one for each of: email addresses, phone numbers and geographic
addresses. I have done it this way so that the user can enter multipleemails, phone numbers and addresses (for example, a work phone, a cellphone, etc). These tables are backed by Hibernate configured lists (so
I have a FK child tables to store these records for the user table).In my view, I have Add and Delete buttons for the tables (and rowsin the table). I don't care when the user clicks and add or a delete
if components are invalid within the page (I only care when they clickthe Register for new users or Save for existing users).I tried marking the command links as immediate, but as those familiar
with JSF would know, opened a can of worms. Since data tables do notsupport submitted values in child components, the user's data from thedata tables disappeared when the view was re-rendered. So a no-gothere.
So I really need the update model phase to complete. (Yes one solutionwould be to enable AJAX for this project and only refresh the tablerow for the add or the delete, but that is beyond my scope for this
project).Is there a way to let validation happen, but regardless of validationerrors and warnings, to go ahead and update the model and execute theaction?I suppose I could use a sub-form from the sandbox, but would that not
cause the input fields in the other tables to loose their valuesanyways since validate and updating of the model does not take placefor non-subform fields (I haven't tried the sub form out yet althoughit sounds like a good idea)?
Another option may be to use a custom component that would update thevalue during the validation phase, but not stop the life cycle (sothat the validation still occurs, and the values would still be kept
for data table rows). I think that will work (didn't think it throughfully yet), but it is messy (Basically a commandLink that doesn't useActionEvent, but a custom event that does it's work during broadcastof process validators or apply request values).
Anyone have a bright idea to get around this solution?Thank you-AndrewPS - also is there any way without partial page refreshing thatinputSecret fields can not loose their value when the view is
re-rendered (maybe by sending a static fake value down to the clientthat says to use the last value and then store that last value inthe user's session?)?
-- Murat HAZERElektrik-Elektronik Mühendisi - Electrical-Electronics Engineer/


Re: Help: Ignore validation and still update model?

2006-06-11 Thread Andrew Robinson

Okay, that is something to consider, but I really don't need that to
happen at the component level, I just need to be able to add an item
to my list (data table source), and then re-render the page with the
new data table row.

I did try s:subForm to see if it would work and it didn't. It suffered
the same problem as the immediate=true, the components in the data
table didn't restore the submitted values on re-render.

I'm going to given the optional validator project from jsf-comp a shot
and will report on my findings.

-Andrew

On 6/11/06, Murat Hazer [EMAIL PROTECTED] wrote:

AFAIK to exceute update model phase you can call processUpdate(facesContext)
func. in the validator method ie:

public void validateAddress(FacesContext facesContext,
UIComponent component, Object objectToValidate)
throws ValidatorException {
...
this.addressModel.processUpdates(facesContext);
.
}

regards


On 6/12/06, Andrew Robinson [EMAIL PROTECTED] wrote:
 Okay, I am having an issue for a non-standard configuration (go
 figure, I think I am in the 20% just about 80% of the time) and am
 looking for help.

 I think what I have to do is continue to the update model phase even
 when validation fails, but I'll tell you what I am doing in case
 anyone has a better idea.

 I have a register user form. It has three child tables (t:dataTable)
 one for each of: email addresses, phone numbers and geographic
 addresses. I have done it this way so that the user can enter multiple
 emails, phone numbers and addresses (for example, a work phone, a cell
 phone, etc). These tables are backed by Hibernate configured lists (so
 I have a FK child tables to store these records for the user table).

 In my view, I have Add and Delete buttons for the tables (and rows
 in the table). I don't care when the user clicks and add or a delete
 if components are invalid within the page (I only care when they click
 the Register for new users or Save for existing users).

 I tried marking the command links as immediate, but as those familiar
 with JSF would know, opened a can of worms. Since data tables do not
 support submitted values in child components, the user's data from the
 data tables disappeared when the view was re-rendered. So a no-go
 there.

 So I really need the update model phase to complete. (Yes one solution
 would be to enable AJAX for this project and only refresh the table
 row for the add or the delete, but that is beyond my scope for this
 project).

 Is there a way to let validation happen, but regardless of validation
 errors and warnings, to go ahead and update the model and execute the
 action?

 I suppose I could use a sub-form from the sandbox, but would that not
 cause the input fields in the other tables to loose their values
 anyways since validate and updating of the model does not take place
 for non-subform fields (I haven't tried the sub form out yet although
 it sounds like a good idea)?

 Another option may be to use a custom component that would update the
 value during the validation phase, but not stop the life cycle (so
 that the validation still occurs, and the values would still be kept
 for data table rows). I think that will work (didn't think it through
 fully yet), but it is messy (Basically a commandLink that doesn't use
 ActionEvent, but a custom event that does it's work during broadcast
 of process validators or apply request values).

 Anyone have a bright idea to get around this solution?

 Thank you
 -Andrew

 PS - also is there any way without partial page refreshing that
 inputSecret fields can not loose their value when the view is
 re-rendered (maybe by sending a static fake value down to the client
 that says to use the last value and then store that last value in
 the user's session?)?




--
Murat HAZER
Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer/


Re: Help: Ignore validation and still update model?

2006-06-11 Thread Andrew Robinson

I just noticed, I accidentally still had immediate=true when I tested
the subForm. After I removed, it I am getting validation errors from
outside of the subform. In fact, it doesn't look like subform is doing
anything at all.

Got required validation errors from components out here
s:subForm id=deleteEmailForm
t:commandLink action=#{userEdit.deleteEmail}
title=#{msg.edit_user_delete_email}
styleClass=imageButton
onclick=if (!confirm('#{msg.edit_user_delete_email_confirm}')) 
return;
b:imageButton url=delete /
t:updateActionListener property=#{userEdit.email}
value=#{emailAddr} /
/t:commandLink
/s:subForm

Any ideas of why this may be happening?