This is so cool! But I have my div in the form and nothing is updated...
Sorry if I am little thick headed but what should I look for?
My code look like this:
$(document).ready(function() {
//#region Form submitting
var options = {
target: '#response',
beforeSubmit: validate,
success: showResponse,
resetForm: true,
timeout: 3000
};
// bind 'frmNewsLetter' and provide an option object with callback
function
$('#frmNewsLetter').ajaxForm(options);
// validate function
function validate(formData, jqForm){
switch($("[EMAIL PROTECTED]").fieldValue())
{
case "1" :
var txtRealMail = $('#txtRealMail').fieldValue();
if(txtRealMail=='' || txtRealMail == 'Adresse'){
alert('Adressen skal udfyldes');
$('#txtRealMail').focus();
return false;
} else {
return true;
}
break;
case "2" :
break;
case "4" :
break
default :
$('#response', jqForm).appendTo("Nyhedsbrev type er ikke
valgt. Vælg venligst.");
return false;
break;
}
note that the switch is not finished..
On 1/30/07, Mike Alsup <[EMAIL PROTECTED]> wrote:
> Am I right if I say that this only applies to input types that is
submitted
> with the form? I've tried to get to a div with id="response":
> $('#response', jqForm).appendTo("Error message");
> return false;
>
> but in vain. I can write to a input element but not anything else,
right?
No. The jQuery selectors work the same way they do outside of forms -
there is no filtering of inputs, etc. Passing jqForm as the 2nd arg
to the $() function is telling jQuery to look only at elements within
the form. The line you provided should work if there is an element
with the id of "response" within the form. If that div is outside of
the form then just get rid of the 2nd arg altogether.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/