wicket - two submit buttons with different validation - wicket

I am using two AjaxButton for the same grid where both of them are not in the form but attached to it.
activateButton = new AjaxButton(ACTIVATE_BUTTON, grid.getForm())
blockButton = new AjaxButton(BLOCK_BUTTON, grid.getForm())
my problem is trying to give each one of them different validation, when the form is submitted i am getting all the buttons validation instead of getting just one of them as I want.

For each of the buttons you can disable the default form processing using AjaxButton.setDefaultFormProcessing() and handle the validation directly in the button by overriding AjaxButton.onSubmit().

I would turn off default form processing and control validation manually.
See wicket manual

Related

Howto add validation in listview in sugarcrm7?

I need to add validation for field:Phone to prevent adding text into phone field in SugarCRM 7.5
is it possible?
Thanks
You can achieve this functionality by different solutions:
Include JQuery Mask plugin and apply validation on all phone type fields.
Create custom field type for phone and apply validation.
Sugar has provided field validation for record view you can also get help from it link.
Here is related link to your question
Thanks Saad,
I did it by following solution:
Create a new custom field
Add my own mask input into _render() and initialize function
I added keypress event into custom field controller to prevent press invalid characters (symbols,....)
I added mustache files to showing proper values in edit,list view,...

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]);
});

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

CakePHP two forms next to each other instead of below each other

I'm developing a form in CakePHP where I want to set two forms next to each other. I'm creating it using this code.
echo $form->input('timeback', array('options' => array('week',1,2,3,)));
This code creates a dropdown, followed by this code:
echo $form->end('submit');
This all works well, except that these two forms should be next to each other instead of below each other.
Is there a way to make this happen?
You should use CSS to solve issues like this.
Anyway try setting form tag with style "display:inline" instead of its default "display:block"