|
|||
|
Hi, Im wondering how I can detect if an button is clicked so that I can do some stuff only when it is clicked. So far I only have worked in the IndexAction part of framework together with the index.phtml in the view. Should events like onclick, onchange etc go into the indexController as long as Im in the same rendered html page? Where do I find the events that are suppported, if any ..
What Im hoping to do is something like the following: when the button is clicked I will transfere the content from a textbox to a listbox when checkboxes/radiobuttons change their status I will save their status in the session object for later use Last edited by Aurheim : 05-13-2008 at 02:36 AM. Reason: Some more info: |
|
|||
|
Sorry, I probably was not clear enough when i wrote this. Doing this the ajax way is not my intention, in fact im not able to do that since the spesifications for my test are small programs without ajax technologi (research assigment for an bachelor degree where I test vcl up against zend under equal conditions) ... Is it possible to do this without javascript or ajax?
If not, where do i put the javascript code/function for the onclick event? Last edited by Aurheim : 05-13-2008 at 07:24 AM. Reason: more information |
|
|||
|
sorry, but could you please explain us what are you really trying to achieve? a form?
have you ever had any contact with php? it seems to me that you are trying to do something, that is too hard for you. ![]() Quote:
|
|
|||
|
Quote:
The problem is not that i have to learn javascrip or ajax, as a already do (but not as an expert). I just cant figure out how to connect the javascript part with the php part in the mvc framework or button events in the view part to php functions in the controller part. What I have done so far is to make some pages in vcl for php framework without using ajax. This is because im supposed to test the responsetime to the pages. The pages uses standard controlls (editboxes, labels, listboxes etc.. )and db grids to display data. The user is able to se reactions on his screen while using the pages. In vcl I was able to set the properties to the elements on the form without using any javascript. It was just a PHP function and the pages had to refresh while changing status to checkboxes etc. Now Im trying to make some pages in Zend framework that let the user test the responstime in a simular fasion (standard controlls, db table) without using ajax, but can not find any way to connect buttons and other controlls to any events like onchange, onclick etc. I just cant se how the framework expect me to use the view parts other than the post/get from any form. It should be possible to do some actions in php when a button, checkbox or other controlls are used without a formelement in the view. If I use javascript for this, how will I be able to run php functions as a result of that action? Testing a possible solution with javascript events also went bad. I declared the onclick event for a button and made a javascript function in the head part under the script tags in the index.phtml, but somehow the function never is executed. Looking at the source code from the browser shows that my forms are not a part of the html body, but are rendered between body and html tag in the end of the page. Googling for examples was not easy ither since most of the examples was to complex or had focus on some ajax framework. I guess what i need is some guidens or maby a example that is easy to understand. |
|
|||
|
Im working 24/7 to finish my assignemts at school now, so forgive me if i seem stupid.
I can use the form element to get the form to post me the attributes of the editbox and the listbox when the submitbutton is pressed. Qestions: 1. if the action is "/" in the form where do the code go? Do I need to make another controller or should i use the indexController? 2. Will the state of the form elements have to be stored in sessions or will they remain as they are? 3. could something simular be used with radiobuttons, using their onchange event?(on a different form). Using it like this will give the desired action as the server has to be inwolved, opposite to javascript implementation which is clientside. |
|
|||
|
Quote:
I think what you want to know is how make the VCL widget call a Zend Framework controller using GET or POST. There is a blog at: VCL for PHP development blog Those guys might be able to help. Good luck! |
|
|||
|
Im trying to make the same pages in Zend as I did in VCL ...
If I let a event go to "/something" in the onclick event, I get an error from Ie telling me that /html/something dont exist. What did I forget? Shouldnt it go to somethingController.php in the /controller/something directory? Or have I missunderstod something? Last edited by Aurheim : 05-14-2008 at 10:05 PM. |
|
|||
|
Quote:
Apparently IE can't make sense of the address. Try using a the full address of the Zend controller rather than a relative address from the current page. Depending on how your server is handling address rewrites it might be something like: http://localhost/yourapp/controller/action or if you're not using rewrites: http://localhost/yourapp/html/controller/action That would call the controllerController's method actionAction(). ![]() |
![]() |
| Thread Tools | |
| Display Modes | |
|
|