I'm trying to intercept the submission of a form in order to create an Ajax request in a Viewport using ExtJS. Some forms have no name (or not Id) and in many cases the submit button has been changed by a simple buttom.
case 1:
<form action="?m=pros&a=add" method="post">
<input type="hidden" name="project_type value='software'>
<input type="submit" class="button" value="Add Project"/>
</form>
case 2
<form action="?m=pros&a=edit" method="post">
<input type="button" class="button" value="Edit Project"
onclick="javascript:doTheSubmitting(this)
/>
</form>
I have in my javascript code
initEvents : function(){
contentPanel.superclass.initEvents.call(this);
this.body.on('click', this.myClick, this);
},
myClick: function(e, target){
/*handler for intercept click over link, submit, buttons*/
//first issue: how to identify: link, button, submit
targeIstLink = e.getTarget('a:not(.exi)', 3); //target is a Link
targetIsForm = target.form; //target is a form????
e.stopEvent();
/*solved*/
if(targetIsLink){
//code to ajaxify a link and
//load it in the viewport pannel
}else
/*not solved*/
if(targetIsForm){
//code to ajaxify a form and load it in the panel ViewPort
}else
if(targetIsFileUpload) { /*coding*/
//code here
}
},
thks in advance for the help