Hi,
I extended datafield to call a defined callback function in javascript.
like so:
public class MyDateField extends DateField
{
protected void configure(JSONObject setup)
{
setup.put("onUpdate", "callOnUpdate");
super.configure(setup);
}
}
This puts a nice javascript into my htmls (see below). However I have 2
issues:
1. for a callback function to work with the javascript calendar, I need the
text 'callOnUpdate' to be included into the Calendar.setup (see below)
WITHOUT quotes. However there's no way I see that I have control of
outputting this without quotes.
2. for the defined funciton (callOnUpdate) to be picked up by the Calendar,
the function must be in the same script-block as where calendar.setup sits.
(At least thats what I conclude after testing this my hand. Im no
javascript-guru). Since this block is rendered by DateField I have no
possibility of writing the function into the block.
Whatwould be the best way to tackel this? Of course, I could totally hack
around DataField ( I can't extend much since most is package-private) but I
really don't want to.
Cheers,
Geert-Jan
This is what tapestry does:
--------------------------------
<script type="text/javascript">
<!--
Event.observe(window, "load", function() {
Tapestry.registerForm('form');
Calendar.setup({"inputField":"a","ifFormat":"%d-%m-%y","button":"a:trigger","onUpdate":"callOnUpdate"});
});
// -->
</script>
what i need:
----------------------------
<script type="text/javascript">
<!--
function callOnUpdate(cal)
{
alert('do something here');
}
Event.observe(window, "load", function() {
Tapestry.registerForm('form');
Calendar.setup({inputField:"a",ifFormat:"%d-%m-%y",button:"a:trigger",onUpdate:callOnUpdate});
});
// -->
</script>
--
View this message in context:
http://www.nabble.com/T5%3A-problems-when-extending-DateField.-More-flexibility-needed--tf4889614.html#a13996007
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]