Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
Matthew Weier O'Phinney-3 wrote: -- Themselves [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 02:12 AM -0700): I'm actually having the exact same problem as the OP with this one, except my code works just fine - I can validate the form no problem, I just can't get it to validate on a tab that loads behind the currently selected one. I am lazy loading my tabs like: ?= $this-contentPane('new-record', '', array('title' = $this-titles['new-title'], 'class' = 'tab', 'href' = /record/new/format/ajax, 'parseOnLoad' = true)) ? because it lets me use $this- correctly, but it also breaks the Javascript I put in the view, like it just never gets called. I'm scratching my head to think of a way around this in Zend. Anyone got the same problem? This is actually not a PHP issue, but a Dojo issue, and even more generally, a JS issue. Basically, XHR doesn't allow execution of script contents returned. So, when you lazy-load content panes, the view script returning the content cannot contain script tags that contain javascript; if they are returned, they're ignored. Dojo, of course, has some ways around this, by allowing you to provide script tags with a type of 'dojo/*', where '*' is one of a limited set of types -- content, method, particular events etc. Read more about this in the Dojo manual. My pastebin example has a few examples: * For the grid, I had one like the following to connect row clicks: script type=dojo/method event=onSelected args=inRowIndex var row = dijit.byId(activePastes).model.getRow(inRowIndex); location.href = ?= $this-baseUrl() ?/paste/display/id/ + row.id; /script * For the forms I lazy load, I had stuff like the following: script type=dojo/connect event=onLoad dojo.connect(dojo.byId('pasteform'), 'onsubmit', function () { dojo.byId('pasteform-code').value = dijit.byId('pasteform-codeEditor').getValue(false); }); /script Note, however, that all your dojo.require statements will need to be provided up front, in the original page load; otherwise, your parseOnLoad is going to fail due to missing dependencies. I've found that this is a good excuse to start building a good layer file (which will also help you later when you go to create a custom build). Again, the pastebin example shows exactly that. [snip] I've had a look at your pastebin application implementation of this, and unless I'm mistaken, it looks like you're actually placing both those two script sections in a different context. The first one is genuinely being called as part of the lazy-loaded html content, and obviously works just fine (it works fine in my ripped off app too), but the second one appears to be called from the context of the initial page rendering - and moving it to the html itself stops it from working. Now, my initial thought was that it's not firing because the onLoad event has long since passed by the time you get around to lazy-loading the tab, which the Dojo docs seem to support (not that I can seem to find any really fantastic Dojo documentation on this stuff). So, as one particular page seemed to suggest, I tried: script type=dojo/method alert('test'); /script It said that it would fire as soon as it got parsed, no matter what. Well. It doesn't. Damn. I don't really mind having to call the JS on the initial page rendering, it's just an intermediate view script to render, no big deal, I'm just trying to work out once and for all what the difference between all these different methods of executing JS are, and whether I'm missing something really obvious. I'd like to give this little ol' application of mine the best start to life I can! -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p20064070.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
I'm actually having the exact same problem as the OP with this one, except my code works just fine - I can validate the form no problem, I just can't get it to validate on a tab that loads behind the currently selected one. I am lazy loading my tabs like: ?= $this-contentPane('new-record', '', array('title' = $this-titles['new-title'], 'class' = 'tab', 'href' = /record/new/format/ajax, 'parseOnLoad' = true)) ? because it lets me use $this- correctly, but it also breaks the Javascript I put in the view, like it just never gets called. I'm scratching my head to think of a way around this in Zend. Anyone got the same problem? vladimirn wrote: So, are we back from conference? :) vladimirn wrote: Ah :) I would like i am there :) Have a nice time :) Matthew Weier O'Phinney-3 wrote: -- vladimirn [EMAIL PROTECTED] wrote (on Wednesday, 17 September 2008, 08:11 AM -0700): Anyone? :( Sorry, a lot of us are at ZendCon this week. ;) vladimirn wrote: Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19534303.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19875163.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
-- Themselves [EMAIL PROTECTED] wrote (on Wednesday, 08 October 2008, 02:12 AM -0700): I'm actually having the exact same problem as the OP with this one, except my code works just fine - I can validate the form no problem, I just can't get it to validate on a tab that loads behind the currently selected one. I am lazy loading my tabs like: ?= $this-contentPane('new-record', '', array('title' = $this-titles['new-title'], 'class' = 'tab', 'href' = /record/new/format/ajax, 'parseOnLoad' = true)) ? because it lets me use $this- correctly, but it also breaks the Javascript I put in the view, like it just never gets called. I'm scratching my head to think of a way around this in Zend. Anyone got the same problem? This is actually not a PHP issue, but a Dojo issue, and even more generally, a JS issue. Basically, XHR doesn't allow execution of script contents returned. So, when you lazy-load content panes, the view script returning the content cannot contain script tags that contain javascript; if they are returned, they're ignored. Dojo, of course, has some ways around this, by allowing you to provide script tags with a type of 'dojo/*', where '*' is one of a limited set of types -- content, method, particular events etc. Read more about this in the Dojo manual. My pastebin example has a few examples: * For the grid, I had one like the following to connect row clicks: script type=dojo/method event=onSelected args=inRowIndex var row = dijit.byId(activePastes).model.getRow(inRowIndex); location.href = ?= $this-baseUrl() ?/paste/display/id/ + row.id; /script * For the forms I lazy load, I had stuff like the following: script type=dojo/connect event=onLoad dojo.connect(dojo.byId('pasteform'), 'onsubmit', function () { dojo.byId('pasteform-code').value = dijit.byId('pasteform-codeEditor').getValue(false); }); /script Note, however, that all your dojo.require statements will need to be provided up front, in the original page load; otherwise, your parseOnLoad is going to fail due to missing dependencies. I've found that this is a good excuse to start building a good layer file (which will also help you later when you go to create a custom build). Again, the pastebin example shows exactly that. vladimirn wrote: So, are we back from conference? :) vladimirn wrote: Ah :) I would like i am there :) Have a nice time :) Matthew Weier O'Phinney-3 wrote: -- vladimirn [EMAIL PROTECTED] wrote (on Wednesday, 17 September 2008, 08:11 AM -0700): Anyone? :( Sorry, a lot of us are at ZendCon this week. ;) vladimirn wrote: Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19534303.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19875163.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
So, are we back from conference? :) vladimirn wrote: Ah :) I would like i am there :) Have a nice time :) Matthew Weier O'Phinney-3 wrote: -- vladimirn [EMAIL PROTECTED] wrote (on Wednesday, 17 September 2008, 08:11 AM -0700): Anyone? :( Sorry, a lot of us are at ZendCon this week. ;) vladimirn wrote: Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19534303.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19756726.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
Anyone? :( vladimirn wrote: Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19534303.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
-- vladimirn [EMAIL PROTECTED] wrote (on Wednesday, 17 September 2008, 08:11 AM -0700): Anyone? :( Sorry, a lot of us are at ZendCon this week. ;) vladimirn wrote: Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19534303.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/
Re: [fw-general] Checkbox and Dojo_foRM validation, please help if anyone know how
Ah :) I would like i am there :) Have a nice time :) Matthew Weier O'Phinney-3 wrote: -- vladimirn [EMAIL PROTECTED] wrote (on Wednesday, 17 September 2008, 08:11 AM -0700): Anyone? :( Sorry, a lot of us are at ZendCon this week. ;) vladimirn wrote: Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19534303.html Sent from the Zend Framework mailing list archive at Nabble.com. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/ -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-if-anyone-know-how-tp19512338p19536978.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Checkbox and Dojo_foRM validation, please help
Hello all, is anyone here able to help about form validation please? After pressing submit button expected behaviour is stopping form submission if checkbox is not checked. I have a bunch of stuffs in my form. So far, checkbox validation wont work. $agreements-addElement ( 'CheckBox', 'ages', array ('required' = true, 'label' = 'I\'m Over 18 years old') ) Submit button: $footer-addElement ( 'SubmitButton', 'submit', array ('label' = 'Submit!','style'='clear:both' ) ); view script: ? $this-dojo()-javascriptCaptureStart() ? function validateForm() { var form = dijit.byId(signup); if (!form.validate()) { alert(Invalid form); return false; } return true; } ? $this-dojo()-javascriptCaptureEnd() ? ? $this-dojo()-onLoadCaptureStart() ? function () { dojo.connect(dijit.byId(signup), onSubmit, validateForm); } ? $this-dojo()-onLoadCaptureEnd() ? div class=signupForm ?= $this-form ? /div -- View this message in context: http://www.nabble.com/Checkbox-and-Dojo_foRM-validation%2C-please-help-tp19512338p19512338.html Sent from the Zend Framework mailing list archive at Nabble.com.