File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Property="*" and null form fields

 
David Yutzy
tumbleweed and gunslinger
Ranch Hand
Posts: 192
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I'm using the property-"*" functionality and the user doesn't enter anything into the form field.
What I'm seeing is that the appropriate "set" method doesn't get fired, so no validation can be performed on that field.
Any way around this?
 
Terence Doyle
Ranch Hand
Posts: 328
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
Why not set a strange default value in the bean and test for it's not having changed.
example:
private String firstname = kkksss ;
validation method(){
....
if( firstname.equals( "kkksss" )
errMessage += "You haven't filled in your name!" ;
....
}
Hope that helps,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
David Yutzy
tumbleweed and gunslinger
Ranch Hand
Posts: 192
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Property="*" is causing me a real pain...
What EXACTLY is the relationship between the form field names, the public variables the get/set property names?
If I make the form fields all lower case, nothing gets fired, others I have to make them upper and lower (firstName fires, but firstname doesn't), likewise faqid fires the FaqID() method.
Is there some consistent way to figure this out?
 
Terence Doyle
Ranch Hand
Posts: 328
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I'm not 100% on this but the convention is for variable names to start with a lowercase letter eg. 'var'. and then joined words get capital letters eg. 'varWithCapitals'
get/set methods capitalize the first letter of the variables so the get/set for the above examples would be getVar(), setVar() and getVarWithCapitals() and setVarWithCapitals() respectively.
As far as I know, all beans follow this rule so if you are using someone elses bean you'll have to follow suit.
Correct me if I'm wrong anybody....
------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
David Yutzy
tumbleweed and gunslinger
Ranch Hand
Posts: 192
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having issues with that convention, however, I had a field on a form named:
Form Field: faqID
Property name: faqID
Get/Set: FAQID()
Never fired get/set. Only when I set the following did it work properly:
Form Field: faqid
Property name: faqid
Get/Set: Faqid()
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic