[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 146
  • Last Modified:

Validation on a form that will be emailed not working

Ok, so I have a form in the mail template that I have designed, its quite basic with only 5 fields, and I want to make sure that all fields are filled in when the user presses send.....

the following code is currently behind the send button
@If(PhoneNbr="" &Request="" &Type="" &RunFreq="" &ExpectedBy=""; @Failure ("Please fill in all fields.");@Success)

My form is set to automatically refresh fields.  Please help this is driving me insane now!
0
Idltd
Asked:
Idltd
  • 3
  • 2
  • 2
2 Solutions
 
madheeswarCommented:
You did not specified when you are populating this Newform with 5 fields?
Best bet would be to do in QuerySave. Add Validation in QuerySave and then save the doc.

like ...

If Source.getfield("Request")="" then
msgbox "Please enter request"
Continue=false
exit sub
end if

etc.,...
0
 
Sjef BosmanGroupware ConsultantCommented:
You used AND instead of OR...

@If(PhoneNbr="" | Request="" | Type="" | RunFreq="" | ExpectedBy=""; @Failure ("Please fill in all fields.");@Success)

I think you'd better have a validation with each field. That's a lot easier, AND the cursor will be in the empty field when validation fails.

Is this for Web or the Notes client??
0
 
IdltdAuthor Commented:
Its for iNotes and Notes clients.  

The form is very basic, users type in their phone number and dept, then there is a rich text field for their request, then 2 dialog lists for them to choose one option from and finally a date picker field.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
madheeswarCommented:
For web, this formulae may not work.
You need to use Java Script validation.

var f=document.forms[0];
if(f.request.value==""){
alert('Please enter request');
return false;
}

etc...
0
 
IdltdAuthor Commented:
So now my code looks like this....

@If(PhoneNbr="" | Request="" | Type="" | RunFreq="" | ExpectedBy="" ; @Do(@Prompt([Ok];"Warning";"Please fill in all fields.");@Return(""));"")

and I get the Warning message for everything the email is not actually sent!  Help!
0
 
madheeswarCommented:
as Sjef informed, place formulae for every field instead of one. Like ...

@if(PhoneNbr="";@Failure("Please enter Phone number");@Success)

do the same to all the required fields... and also place the code in the fields InputValidation. This applies only for Notes Client. For Web, use...
//For normal text
var f=document.forms[0];
if(f.request.value==""){
alert('Please enter request');
return false;
}

//For Dropdowns:
topic= document.forms[0].topic_k.selectedIndex
      if((topic == -1)  || (topic == 0))
      {
      alert("Topic is a required field.")
      document.forms[0].topic_k.focus()
      return ;
      }
0
 
Sjef BosmanGroupware ConsultantCommented:
Did you put the code in the Send button? That seems okay to me... For Notes, that is.

For the Web, you have to add some JavaScript-code. What version of Notes do you have? Assuming you have R6, you need Formula-code in the button for Client (i.e. Notes) and for Web you need something like Madheeswar said:
    var f= document.forms[0];
    if(f.Request.value==""){
        alert('Please enter request');
        return false;
    }
    if(f.PhoneNbr.value==""){
        alert('Please enter Phone number');
        return false;
    }
    if(f.Type.value==""){
        alert('Please enter type');
        return false;
    }
    if(f.RunFreq.value==""){
        alert('Please enter Run freq');
        return false;
    }
    if(f.ExpectedBy.value==""){
        alert('Please enter Expected by');
        return false;
    }
    return true;

Please note that JavaScript IS case-sensitive...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now