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

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

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).

Setting values to a form which is not rendered yet

I have a form within a tab. It is second tab so it doesn't render until you open it.
I have tried to submit data to the form with Ext.getCmp('DetailsForm').getForm().setValues(selections[0]); but it says that it is not a function. Probably because it is not rendered yet. What I have to do?
Set the deferredRender config property of your Ext.tab.Panel to deferredRender: false
That will force the rendering of all tabs instead of just active ones. Now the form will be there. As mentioned before I recommend you also to use myTabPanelRef.down('from').getForm().setValues(selections[0]); to access the form.
subscribe to the second tabs show event OR painted event
then look for the form preferably by using .down() method as this wont look with in the entire DOM.
set the values
Use render event of form panel.
Your code will be something like this -
Ext.getCmp('DetailsForm').on('render', function(){
this.getForm().load(selections[0]);
});

JavaScript: How to force a page reload on reset?

I have a page with some generated HTML that survives the form's reset button. It is a problem because that HTML is inconsistent with the values in the cached default form.
In principle I guess it could be solved easily if I could force a hard reload from the server when the user presses the reset. However I see that the Chrome browser does not support the onReset event (in fact it is deprecated in HTML5).
But perhaps I could work around the missing onReload event. Can I re-define what happens when the reset button is pressed? In my case the apply and reset buttons are located in general HTML templates which I cannot change. Can I attach a function to the button from JavaScript?
You can replace the "reset" button , by a regular button.
And use the "onClick" event, to trigger a page reload.
EDIT
oops I missed the template part,
You can add a function to a button from Javascript.
First you need to "get" the button, with something like document.getElementbyId('resetButton');
If the button doesn't have a ID, you still can to retrieve it by doing javascript dom traversal
then you can add a function like :
var resetButton = document.getElementbyId('resetButton');
resetButton.onclick= reloadPage;
function reloadPage(){
window.location.reload();
}

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().

Cancel button Icefaces with immediate=true

I have a form with save and cancel buttons, cancel button has immediate=true but it doesn't clear the submitted values in the form. I google it and I found this page http://jira.icefaces.org/browse/ICE-1343;jsessionid=2996E8791051E9D6775348E6CE1BC118, it says that the solution is to put an action listener in the cancel button that calls a function that clear the submitted values, it works partially because when I have other tags like panels it doesn't clear them.
Any solution? thanks
Check out the solution presented here : http://www.icefaces.org/JForum/posts/list/13807.page
I personally haven't found a good solution beside the two most obvious ones : manually traverse the UI components and nullify them
We used partialSubmit="true" without setting the immediate attribute to true. This works in Icefaces 1.8.2, but there is one drawback. If the validation failed once, it will be executed always.
With Icefaces 2.x, the suggested way is to use singleSubmit="true", but I haven't tried it.
I use immediate="true" and partialSubmit="true" on cancel and something like this for actionListener
public void cancelPopup(ActionEvent event) {
FacesContext.getCurrentInstance().renderResponse();
}