Parsley validate dynamic input field - parsley

I'm trying to validate an input field which is 'disabled' when the page loads, but it will, somehow, become visible and editable.
I excluded [disabled] from parsley, but when I'm trying to refresh constraints on that field, nothing is working. I tried to call addValidation() when the field appears but no success.
Is there any method to do this? I can't destroy the form (that's not working either).

Found out how to do this.
Just call _refreshFields() on your form.
$('form').parsley()._refreshFields()

Related

MS Access 2013 textbox update macro

What I am trying to accomplish:
Use button to open a form, filter the form, and set specific value to an unbound textbox in the opened form's header. There are multiple buttons being used open the same form and I would like this textbox to changed every time a specific button is clicked.
What I have done so far:
Used a macro to open the form and the "where" condition to filter the records. I also used "SetProperty" to change the value of the unbound textbox in the opened form's header depending on which button was clicked. When I do used the SetProperty option in the macro I get the error "The control name ... is misspelled or refers to a control that doesn't exist. Error 32004
I have verified numerous times that this is the correct name for the textbox and everything. I am pretty new to access and don't do VBA all that much so any assistance would be greatly appreciated. Thanks.
First Form and Macro for the "Physical Security" Button
Second form with error and unbound txt box I want to change to "Physical Security"
A few Ideas to track down your problem:
Maybe there's a problem with opening and (immediately) accessing the forms controls(?) You could try to fire a macro from within the same from that (only) changes the value of this text-box to make sure it definitely works there. Of course you'd want to make it work there if it failed before you'd go back to your original problem.
Is the property called value? Could it be text?
Are you sure you need to separate (all) hierarchies using !? Just by desperation: Maybe try using Forms!frmVW.txtXY or Forms.frmVW.txtXY
If that doesn't solve it:
It's often best to reduce your problem to it's very basics. Copy your application (!!!!) and radically delete unneeded stuff. Or start a short experiment from scratch (one or two forms, maybe only a button and a textbox, a macro, most probably not even a single Datatable/Source).

How do I stop Zend_Form::isValid from removing the values of submit buttons?

I have a Zend_Form object that generates a form in my view.
It does POST processing and submits data to my database.
Sometimes, I notice that my submit button, which simply says "Update Your Changes" is stripped of its value, so its just a button with no text value. I'm surprised Zend_Form is not coded to ignore clearing values from submit buttons.
Is there a way to stop this from happening?
You can try setting the value forcefully in the decorator:
<?php echo $this->element->update_btn->setLabel('Update Your Changes');?>
In addition to s-rupali's answer, you might also try isValidPartial(). This method, regardless of how you implement it (I'm a c# kinda guy) will not validate disabled elements You can then temporarily set your button to disabled, whilst the submission occurs. Afterwards, you can create another method to re-enable it.
http://framework.zend.com/manual/en/zend.form.quickstart.html#zend.form.quickstart.validate

windows form validation issues (.net2.0 )

I need help with some things regarding windows form validation:
closing form using standard form closing button (X) triggers validation of all controls.
Is there a way to supress it when closing form using this button, and force it only when pressing my own button?
validation of textbox (possibly other controls, I tested only textboxes) wont invoke when i change text (value) programatically. I need to type text directly into textbox if I want validation to be triggered later, before form is closed. How to tell the form that some control needs validation (but not to trigger it immedidately)?
Thanks.
EDIT:
(1) solved, using this answer.
(2) now, after i set AutoValidate property to false and added ValidateChildren() to my button, only 1 control is being validated with its current value, values of all other controls are revert to value binded to them from DataSource object . I checked it in Validating event - only first control validating keeps its current value, after this validation is finished, other controls' values are replaced with values from DataSource object. I don't understand why. Any clues?
Try this, maybe it could help you. ( for 1)
In the Forms Load event you can put
this.ControlBox = false;. This will hide your X button with the other buttons at the top.
The Form has a Form1_FormClosing event. In that Event you could call the triggers you need. Put a button on the form, and in button_Click event you type this.Close().

Disable form validation in MVC2

Is it possible to programatically disable form validation in MVC2?
I'm hoping there is some kind of command that I can put in a custom ActionMethodSelectorAttribute, making it possible to prefix ActionResults where I want form validation disabled.
The reason for this is that I have a form with multiple buttons, one button adds a new row to a child object of the model - which consequently creates a new row on the form.
This works fine, but validation is fired for the form each time "add" is pressed, and so the new fields flag up validation errors before the user has a chance to enter data.
I've found an alternative solution to this.
Rather than use multiple form buttons, I've used a custom html helper which produces a "Add" link.
This helper places the current Model in TempData and produces a Link to Add/{id}.
I'm not sure this is the cleanest solution, but it allows child elements to be added without validation firing. To tidy things up a bit, I specified the form as such:
Html.BeginForm(view, controller, new { id = Model.ID })

Unable to call getValues() on an Ext Js FormPanel on initialization of a container Panel

I have an Ext Js panel that I am adding to my main TabPanel. The panel I am adding contains a FormPanel as one of it's items and inside the FormPanel I have a Name field. What I want to do is change the name of the Tab based on the name in the form field.
The problem is that if I call the FormPanel's getForm().getValues() inside of the panel's initComponent, I get the following javascript error:
Uncaught TypeError: Cannot read property 'dom' of undefined
If I do this outside of initComponent (e.g. on a button press) everything works fine. After doing some testing, I think the issue is that the FormPanel isn't actually rendered yet (and thus the dom doesn't exist), getValues() fails. However, I can't seem to figure out a way to get my FormPanel's values from the Panel on load.
I tried to listen for events. I tried:
this.detailForm.on('afterrender', function () { alert('test'); });
but doing this showed that AfterRender is called prior to the form actually being rendered (it's not visible on the screen). Changing the alert to my custom function handler produces the previous dom exception. I attempted to use the activate and enable events instead of afterrender, but even though the API says that FormPanel fires those events, the alert('test') never gets called.
I can't seem to find any way for my panel to get the inner FormPanel's values upon loading my panel. Does anyone have any ideas?
Using getFieldValues() in place of getValues() will collect values by calling each field instance's getValue() method instead of by reading from the DOM. This should allow you to get your values regardless of the form's rendered state.
I've got the same problems on one of my projects, I managed to fix it using the afterlayout event.
I'd give setting .deferredRender:false a try.
Ext.TabPanel.deferredRender
Probably best to roll out of your afterlayout changes, then test with just a straight deferredRender:false config item.
I believe the problem is caused because the inactive tabs are not rendered until they become active. In your scenario, you cannot get the values, because they don't exist until the tab is activated/shown.
Setting deferredRender:false will render the items within all tabs. There could be a performance hit by setting deferredRender:false, so testing you must do.
Hope this helps.