TOPIC:

Submit button doesn't check if mandatory input is given 3 years 1 month ago #229981

  • Topic Author
  • Inksane
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 40
  • Thanks: 0
Hi,

1,5 years ago I created a Breezingform on my website, and now I would like to revisit it.
For example 4 fields need to become mandatory.

When I add those 4 fields, and check the 'mandatory' option, I can still send my form well without giving values in those fields.

My submit code has been overwritten in the past, because I wanted to be the email subject the clients name, and the sender of the mail is the clients email (so I can easily reply).
This has to stay.

Is my form not being validated/checking for mandatory values, because of this overwriting submit code?
Or what should I do more to prevent the form from sending if those values are empty?

submit button code:
function ff_EndVerstuur_action(element, action)
{
switch (action) {
case 'click':
ff_submitForm();
break;
default:;
}
}


End Submit Form Custom code:


$this->execPieceByName('ff_InitLib');
$from = ff_getSubmit('mail');
$fromname = ff_getSubmit('mail');
$subject = ff_getSubmit('naam'); // Change to your preferred Email subject
$recipient = 'info@inksane.be'; // Change to your admin Email address
$body = '';

if (ff_getSubmit('EndVoorNaam') <> ''){
$subject = ff_getSubmit('EndVoorNaam');
}else{
$subject ='mislukt';
}

if (ff_getSubmit('EndMail') <> ''){
$fromname= ff_getSubmit('EndMail');
}else{
$fromname ='mislukt';
}



if (count($this->maildata)){
foreach ($this->maildata as $data){

$testEx = explode("\n", trim($data[_FF_DATA_VALUE]));
$cntTestEx = count($testEx);
if($cntTestEx > 1){
for($ex = 0; $ex < $cntTestEx; $ex++){
if(!is_array($attachment) && $attachment != ''){
$attachment = array_merge(array(trim($testEx[$ex])), array($attachment));
}
else if(is_array($attachment)){
$attachment = array_merge(array(trim($testEx[$ex])), $attachment);
}
else{
$attachment = trim($testEx[$ex]);
}
}
}
else{
if(!is_array($attachment) && $attachment != ''){
$attachment = array_merge(array(trim($data[_FF_DATA_VALUE])), array($attachment));
}
else if(is_array($attachment)){
$attachment = array_merge(array(trim($data[_FF_DATA_VALUE])), $attachment);
}
else {
$attachment = trim($data[_FF_DATA_VALUE]);
}
}

}
}


foreach ($this->maildata as $data) {

if( $data[_FF_DATA_NAME] == 'upload' )
{
$body .= $data[_FF_DATA_TITLE].': www.inksane.be/images/to/uploads/ ' . basename($data[_FF_DATA_VALUE]);
} else {
$body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl() . "\r\n";

}
}

$this->sendMail($from, $fromname, $recipient, $subject, $body, $attachment); // This line actually emails the form.

Please Log in or Create an account to join the conversation.

Submit button doesn't check if mandatory input is given 3 years 1 month ago #230005

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

The code from End Submit to send email should work regardless the Submit button. You can use a regular submit button to submit your form, there is no need for custom one.

Despite that, if you are using the custom Submit button for some other reason, in the Actionscript of the "EndVerstuur" submit button, set Type to Library, Action to click and Library to FF::ff_validate_submit.

Let me know whether this solved your problem.
If you have more questions, feel free to ask.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

Submit button doesn't check if mandatory input is given 3 years 1 month ago #230069

  • Topic Author
  • Inksane
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 40
  • Thanks: 0
Oh, that makes sense :)

Thanks a lot!!

Please Log in or Create an account to join the conversation.

Submit button doesn't check if mandatory input is given 3 years 1 month ago #230083

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello again,

I'm glad that I've helped. :)

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.047 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!