I have a form in extjs and I need to do some validation tests on it on the server side and return a message error but I have no idea how to do this!
I need to check if there is a new added ip address
I also need to check if it is a valid address (I have a C # function that can do this)
if these conditions are in order, it can be added. if not, I would like to show the user an error message saying what the problem is
now, when I call my submit save button, I do these tests in my C # before making an insert request, but even if these tests do not fit, they still say success in the form, because I donβt know how say extjs4 error
change this is what I'm trying to do so far
my submit form:
this.up('form').getForm().submit ({ url: 'AddData.ashx', params: { action: 'addip' }, success: function (form, action) { Ext.MessageBox.show({ title: 'Success !', msg: 'IP added successfully<br />', icon: Ext.MessageBox.INFO, buttons: Ext.MessageBox.OK }); Ext.getCmp('addipform').getForm().reset(); }, failure: function (form, action) { switch (action.failureType) { case Ext.form.action.Action.CLIENT_INVALID: Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values'); break; case Ext.form.action.Action.CONNECT_FAILURE: Ext.Msg.alert('Failure', 'Ajax communication failed'); break; case Ext.form.action.Action.SERVER_INVALID: Ext.Msg.alert('Failure', action.result.msg); } } })
inside my AddData.ashx there is an addip () function that is called when the action param is "addip" this function returns:
public string addip() {
but nothing happens!
source share