Topic RSS
4:02 pm
I'd like to to if it is possible \"out-of-the-box\" (without big hacking), to have a mandatory field dependant of a previous selection in the form :
I explain with my case :
I have a radiobutton field \"Send your drawing\" with 2 cases : – by fax, -by mail
If the client selects by mail, he would have to submit a file (mandatory), but if he selects by fax, the file shouldn't be mandatory to be sent.
So how to achieve that ?
Thanks in advance
7:13 pm
March 6, 2005
Offline9:30 am
I've tried in the page displaying the form :
var radiofield = 'cf_field_16';
var uploadfield = 'cf_uploadfile-17';
jQuery("input").click(function(){
if (jQuery('input[type=submit]')
&& jQuery('input[type=radio][name='+radiofield+']:checked').val() == 'mail'
&& jQuery('#'+uploadfield)[0].value == ''){
var text = jQuery('#usermessageb span').text();
if (text.indexOf("upload a file") < 0){
jQuery('#usermessageb span').html(text+"<br />Please upload a file");
return false;
}
}
jQuery('form[id=cformsform]').submit(function(){
console.log('Submit blocked!');
return false;
});
});
This adds a message "Please upload a file" at the end of the warning if i don't choose a file when the file radiobutton is checked, but the form is still sent, even without the file : the ajax stuff of cforms overrides this because the file is not checked mandatory in the admin.
Can't we override or bypass the js for this part ?
Most Users Ever Online: 959
Currently Online:
54 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
tracedef: 43
mores: 21
Gyrus: 20
frozenwaste: 18
asuffredini: 15
photoworks: 14
Member Stats:
Guest Posters: 3566
Members: 1464
Moderators: 3
Admins: 1
Forum Stats:
Groups: 1
Forums: 4
Topics: 5171
Posts: 18411
Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass
Moderators: Paul (421), cnymike (8), sonika (95)
Administrators: Oliver (6398)
FAQs
Home
Add Reply
Add Topic
Quote









