-
1. Re: Force OnChange with selectDate selection
james_hays Apr 11, 2007 4:02 PM (in response to james_hays)Sorry, forgot to mention which file I modified.
It's the calendar.js file included in the seam-ui.jar -
2. Re: Force OnChange with selectDate selection
shane.bryzak Apr 11, 2007 9:28 PM (in response to james_hays)Someone's submitted a patch to fire the onchange event, I'll try to get it applied in CVS sometime today.
http://jira.jboss.org/jira/browse/JBSEAM-1164 -
3. Re: Force OnChange with selectDate selection
james_hays Apr 12, 2007 3:38 PM (in response to james_hays)Interesting. I had attempted to use the onchange(), same as the patch does, but it kept giving me javascript errors in FireFox. That's why I went with the focus/blur dance. Also, acording to http://www.w3schools.com/htmldom/dom_obj_text.asp
only onselect(), onfocus(), and onblur() are valid methods for a textfield object. -
4. Re: Force OnChange with selectDate selection
csweeney May 10, 2007 12:41 PM (in response to james_hays)What version/platform? (I'm the OP for the patch)...
-
5. Re: Force OnChange with selectDate selection
james_hays May 10, 2007 1:04 PM (in response to james_hays)I'm running Firefox 2.0.0.3 on Windows XP.
-
6. Re: Force OnChange with selectDate selection
sergeysmirnov May 10, 2007 3:47 PM (in response to james_hays)James, as I see the primary source of the event is calendar, but not an input field. Input field is a target of changes made in calendar. So, may be it is better to send update right from it instead of dancing around text field.
You can send update invoking the a4j:jsFunction right from the __clickCalendar function. jsFunction allows to pass parameters (like selected date in your case) and update the bean property using assignTo attribute of a4j:actionparam -
7. Re: Force OnChange with selectDate selection
james_hays May 10, 2007 4:10 PM (in response to james_hays)That only works if they use the calendar. If they manually type in the input box I still need a way to fire the event. Your way would require me to handle the event in two locations wouldn't it?
-
8. Re: Force OnChange with selectDate selection
sergeysmirnov May 10, 2007 4:56 PM (in response to james_hays)Why not? I suggest to use the primary event to trigger the update. If user inputs the date manually in input field, it will be a source.
The similar situation with input field and attached suggestion box. if user selects from the list, onselect on suggestionbox is event that can be used to update. Otherwise, onchange on input field if it is manual input. -
9. Re: Force OnChange with selectDate selection
james_hays May 10, 2007 6:09 PM (in response to james_hays)Sure, it can be done that way. It'll just two listeners attached to my code instead of one. It's a fine way of doing it.
I'm guessing you see the input field and calendar popup or suggestion box as separate components tied together. That's certainly how you have to use them in seam.
I see the inputfield and calendar popup as one component and as such would like to use it that way. I can't have one without the other, so why keep them separate? Same with a suggestionbox. I can't have a suggestionbox without an inputfield, so why are they separate? That's for another thread though... -
10. Re: Force OnChange with selectDate selection
sergeysmirnov May 10, 2007 6:51 PM (in response to james_hays)if you use MyFaces, you might use t:inputText instead of h:inputText . You can attach suggestionbox to any components that has a value attribute and onxxxx event set. This is an idea of 'for' attribute that allows to enhance the existing component instead of replacing it.
This is similar a4j:support. It enhances the existing component rather than requires to replace existing component with new one having built-in Ajax support.
Actually, both approaches (enhancing and built-in) make sense. We use them both in Ajax4jsf and RichFaces. -
11. Re: Force OnChange with selectDate selection
james_hays May 10, 2007 7:17 PM (in response to james_hays)What is t:? I thought those were the old tomahawk components that aren't recommended.
-
12. Re: Force OnChange with selectDate selection
sergeysmirnov May 10, 2007 9:23 PM (in response to james_hays)t: is just for example. It does not matter for suggestionbox, it is t: h: my: foo: or bar: :-)
-
13. Re: Force OnChange with selectDate selection
csweeney May 29, 2007 11:27 AM (in response to james_hays)BTW - I've been following this thread, and hoping to perform some testing/debugging associated with the particular OS/browser that is exhibiting problems. In the meantime, I think there is a bit of disagreement about which elements implement onchange - The HTML 4.0 specification http://www.w3.org/TR/REC-html40/#minitoc and, specifically, the input element http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4
indicate that a standards compliant browser implement onchange for input="text" elements. It would appear that this is may not be the case for Firefox 2.0.0.3 on Windows XP (as reported) - although, after re-reading the thread I think that there are two separate things going on - one (mine) is a need to call (if defined) the function attached to the onchange event associated with the text input which is the target of the selectDate widget. The other is a need to be able to programatically generate an onchange event. Related situations but not quite the same.