Unable to get reset form using button in mvc form - forms

I'm trying to use MVC structure while building a sencha touch 2.3.1 app.
I have a form, and two buttons one for submission and other for resetting it.
I have added form view code in file app/view/form1.js,
controller code to app.controller.form1 and
here's my app.js.
Can someone point out where I am wrong, and to a source where I can get a better understanding of how to use (I know what MVC is) MVC structure in Sencha. There documentation is a bit to simplified to include all this.
Thanks in advance.

Your Problem is the getting of the form:
form1.reset();
You can get it with the auto generated getter method in the controller:
var form1 = this.getForm1();
And remove your double colon "::"

Related

Create / Edit / View the same form with Angular

I am creating a slightly elaborated form with Angular. This form can be submitted, then modified or simply displayed (with everything in read-only for example).
For now I have 3 templates with 3 controllers for each action (submit / edit / view) and the form is added as a partial (ng-include). The form has also its own controller. Is it the right way?
Also, should I make the form's controller the children of the templates' controllers or the opposite? I am using the same model for each action behind the form and I guess it should be injected through the template's controller.
It's my very first attempt to do this and I would like to have a few advice's and hints since I am afraid of going the wrong way. Thank you!
yo can use different template for each of them with single controller, different controller for each of them is not a good idea because there may be some common function in them then you need to write that function in each of them.
you can use common model for them,i am doing the same.
I see this is promising solutions to what you are looking for
can you try this http://vitalets.github.io/angular-xeditable/#editable-form

File Upload not working after moving form field

I have a large form with a image upload field working ok.
Field is defined in model as:
$this->add('filestore/Field_Image','thumbnail_id');
Then I created two tabs inside form:
$tabs=$form->add('Tabs');
$main=$tabs->addTab('General');
$design=$tabs->addTab('Design');
And moved image field to design tab:
$design->add($form->getElement('thumbnail_id'));
Now I can't upload files. When I try I get the following javascript error
Error: cannot call methods on atk4_form prior to initialization; attempted to call method 'submitPlain
Is there any other way to move the field or have upload working again after moving it?
I was trying to use the same method ($design->add($form->getElement('my_element'));) to move a slider into another place on the page. That didn't work - I think it was because the slider input field is not placed on the page the same way as other input fields.
So I tried with the jQuery appendTo-method (I found the hint in a comment from romanish in a documentation page). That worked. But then I experienced the same problem as you - and in the end I gave up and solved the problem by editing the slider-class page.
So I can't help you, sorry, but I guess this points out that there is a general problem related to getting input from moved form elements.

How to scroll to first error inside a Spring form?

My registration is using Spring forms and validates the data after submit, the form:errors will be printed out if there are errors. I need to scroll the page down to the first form:error so the user hasn't to search for the error, is there a way to do that?
cheers
I haven't tried any of them, but I can think of two possible ways:
With Javascript. Spans generated by < form:errors /> have a class (I don't remember at the moment) or you can force on using cssClass attribute. Would be very easy using this jQuery plugin to scroll to the first one.
Without Javascript. This will be a lot more difficult and I'm not sure it will work:
In your controller, instead of returning a direct view you must do a redirect to something like /myForm#error.
In order to don't lose your model, you must use FlashMap attributes.
"Subclass" < form:errors /> tag. It must have the same behavior but it has to include an anchor named error on the first error of the page.
I think you can do it with anchors. -- But you need to implement it by your own.
My idea it to put anchors on all input files. And then have some java script that is able to scoll to an anchor. This java script is invoked on page load if the error object contains errors. -- This errors contains the name of the field. So if you have some schama for naming the anchors it should be possible to invoke the jump to an anchor script with the name of the field hat has an error.

Validating datagrid cell values using Enterprise Library config file

In my application,I am working on WPF with MVVM design pattern doing validations through Enterprise Library using configuration file.
I want to validate my grid cell values through enterprise library configuration file.In my view model I have an objservalble collection property that is bound to the datagrid in a view.
Then,I want to validate one of my cell value for range validation using enterprise library..But I am not finding any proper way to do the same.I don't want to use any custom validator rather want to achieve with the enterprise library configuration file only.
Actually while adding a validation to datagrid column we are binding like:-
<xa:ValidatorRule RulesetName="NameOfRuleset" SourceType="{x:Type vm:ViewModelType}" SourcePropertyName="NameOfProperty" ValidationSpecificationSource="Configuration" ValidatesOnTargetUpdated="True" />
But as in this case my view model will not have a property specifically for this field rather it has collection,so i am stucked on how to do the same,
Can anyone please guide me how to achieve the same.Please let me know if my explanation is not clear enough.
Found a solution for the same.
Created a one more class for my collection & in configuration file as well as in view I am refering to that class type only instead of refering to my viewmodel.
Reason why I created new class is I am using Entity framework & i cannot refer to DAL layer in my UI but I can refer to my own type in view.
In this way it solved my problem of adding validation rules to the datagrid that is binded to the collection.
Incase anybody needs sample code,let me know I can provide the same.

Zend Framework Navigation - dynamically adding parameters

I am experimenting with Zend_Navigation to build breadcrumb for a web site. I created an XML file which lists the hierarchy of pages. Things are working fine for the most part except for pages that have dynamic parameters.
For example, there is a group page which has the URL " www.../groups/gid/1001". The id 1001 is dynamic so it changes for different groups. Because of that I cannot put it in the XML file. In that case, ZF generates a link without including any parameters, which of course won't work.
One solution I found is dynamically injecting the parameters to the Zend_Navigation object. This is working fine except that I need to do it for each action or controller.
Is there a better way to handle it? Does ZF have any classes to do this work?
I will appreciate any feedback.
Thanks!
http://zend-framework-community.634137.n4.nabble.com/Creating-a-dynamic-database-based-Zend-Navigation-item-td660805.html
And/or start reading here: http://framework.zend.com/manual/en/zend.navigation.introduction.html
At which point do you know the group ID to use in the navigation?
If it's early enough, you could simply create your own bootstrap init method to insert the navigation item, just remember to call $this->bootstrap('navigation') at the top of your method, eg
protected function _initCustomNav()
{
$this->bootstrap('navigation');
$navigation = $this->getResource('navigation');
// add custom item
return $navigation;
}
Disclaimer: I'm pretty sure the navigation resource is just called 'navigation'