nancom (12) [Avatar] Offline
#1
i have some problem
After i create my little application from spring roo 1.2 i try to modify field in .jspx. I need to disable field in update page but when i set z="user-manage" and add attribute disabled="true" and run web application after i update other field and save value of field that i disable is gone.How can i do for this case ?
ken.rimple (246) [Avatar] Offline
#2
Re: When i use disable=true it's don't binding data to class
The attribute value should be user-managed I think.
MikB (202) [Avatar] Offline
#3
Re: When i use disable=true it's don't binding data to class
Am I dreaming or isn't Roo expected to set the z-value to "user-managed" when it detects this field have been changed by the user?

This is from "Roo in Action" version 10, 5.5.1 "Modifying Fields and Columns" (logical page 197):
"If the fields are changed, such as by adding, updating, or removing attributes, the z tag will change value to "user-managed". Roo will no longer modify that field.
If you decide to revert to letting Roo manage that field or component, simply remove the z= tag, and let Roo re-create the tag. "

So the best advice here is, don't change the z-field value yourself, let Roo do it. Also read "Roo in Action"! smilie

Message was edited by:
MikB
nancom (12) [Avatar] Offline
#4
Re: When i use disable=true it's don't binding data to class
i already change z="user-manage". my problem is value in field that i set disable="true" and z="user-manage" was gone when i update it.
MikB (202) [Avatar] Offline
#5
Re: When i use disable=true it's don't binding data to class
nancom, if you're not already, you should use version control software, like CVS, Git or Mercurial. I use the latter with the Eclipse plugin MercurialEclipse. I recommend all developers — using Roo or anyone — to use version control.

If you have such software and have saved the previous version —which you should have done — you would in the situation you're in go back to the version where it worked, i e it didn't say "user-manage".

For your little problem this is probably not necessary. If you had read the pages of "Roo in Action" I quoted from, you would also be able to read the passage "If you decide to revert to letting Roo manage that field or component, simply remove the z= tag, and let Roo re-create the tag"

That Roo changes the complete tag is because you edited the z-value, when you should have let Roo set it to "user-managed" for you. Roo most likely regards the value "user-manage" — without a "d" — as garbage and rewrites the tag under its control. Fix that and your tag edits should stick.

Alt 1
So do what the quote from Roo in Action says, and then after it have been saved is reverted and still is under Roo control, i e with a code value in the "z" attribute, edit the tag in the way you want it, save the file and see whether Roo changes the z-value to "user-managed" for you.

Alt 2
Of course, you could also choose the simple way of setting the z-value to "user-managed, that is with a "d" as the last letter. Did you try a d?

I would choose Alt 1 first to make sure Roo functions properly. If not make a bug report supplying my example project, openly if possible or at least volunteer to email it. Then choose Alt 2.

Alt 1 should work though.

Message was edited by:
MikB

Message was edited by:
MikB
nancom (12) [Avatar] Offline
#6
Re: When i use disable=true it's don't binding data to class
thanks a lot for your explanation.

But my problem is not a roo generate problem.
i already know about roo generate mechanism that when you modify some field and roo regenerate it in roo way.

i try to use disable="true" attribute and change z="user-managed" in update.jspx.After that when i run application by mvn jetty:run, Application
run completely but when i going to update page for modify data in other field that i can modify except field that i disable it every value was saved except value in my disable filed. I need to know how to modify tag for this case ?
MikB (202) [Avatar] Offline
#7
Re: When i use disable=true it's don't binding data to class
Can you supply the actual code for your tag that you use in your jspx?
ken.rimple (246) [Avatar] Offline
#8
Re: When i use disable=true it's don't binding data to class
You are not using the disabled property correctly. It means not to generate the field at all. Since the form is not stored in a session, you would have to create your own HTML hidden field to preserve the value. Disabled therefore means Roo should not generate the field and you can directly write your own tag instead.
nancom (12) [Avatar] Offline
#9
Re: When i use disable=true it's don't binding data to class
thanks ken.rimple

you means i need to put something like
<input type=hidden id="someDisableField" value="${ClassAttribute}" />
right ?
ken.rimple (246) [Avatar] Offline
#10
Re: When i use disable=true it's don't binding data to class
> you means i need to put something like
> <input type=hidden id="someDisableField" >
> value="${ClassAttribute}" />
> right ?

I think we are saying the same thing, yes. So, you'd have your disabled field staying in the jspx file, so Roo doesn't overwrite it, then do your own input field in there instead. If you only want it to be hidden in the form, then yep, that's correct. You could really make it anything you want since the original form field is not there.

Ken