Execute procedure if text field is not empty otherwise alert via javascript the message field cannot be empty - oracle-sqldeveloper

I have been struggling to find a method to do this validation and execute my PL/SQL procedure.
Required :
Need to check field is empty or not and alert via javascript field is empty and my Dynamic action should not be executing.
If my text field is not empty then only my Dynamic action PL/SQL procedure should be running.
My form as below fields :
Subject : `TextField` -> P1_SUBJECT
Message : `TextField` -> P1_MESSAGE
Submit : `Button` -> property set to -> Execute Validation -> ON
Problem I am facing :
I have set the property for Subject , Message --> Value required : ON
Then created dynamic action on Submit button -> selected option -> Execute server-side code
In PL/SQL code -> written my PL/SQL code to send mail
Now without entering values to Subject , Message -> If I click my Submit button -> Then also my procedure gets executed and mail is sent. This I don't want it to happen .. unless my Subject and Message field is not empty my procedure should not be triggering.
Code :
begin
apex_mail.send(
p_to => 'person#exmaple.com',
p_from => 'me#example.com',
p_body => :P1_MESSAGE || utl_tcp.crlf,
p_subj => :P1_SUBJECT);
commit;
end;
Any solution is much appreciated !!!

Allow me to suggest another solution:
Instead of using a dynamic action on submit, create a page process that fires on submit with that same pl/sql code. If the value is required then validation will fail and the page process will not fire.

Related

syntax error in replace expression for subject making in access

i am very new to expressions in access,
In my access data base i need to parse some fields into subject of the outlook when send mail button clicked in the form , for this i am using replace expression as below :
=Replace(Replace("Rework |1: Reason|2:Drawing Number|3","|1",Nz([Order_Number],"")),"|2",Nz([Reason_for_rework],"")),"|3",Nz([Drawing_Or_Mat_Number],""))
but for this i am getting error as :
"the 'emaildatabaseobject' macro action has an invalid value for the 'subject' argument
Kindly help me how to solve this
You syntax is completely off. You may have Choose in mind:
=Choose(YourCategoryID,Nz([Order_Number],""),Nz([Reason_for_rework],""),Nz([Drawing_Or_Mat_Number],""))

Send a personnalised email from a Google Form

I'm starting a new project. I have to send a confirmation email when someone purchases a book with my Google Form. By now, I can send an email when you complete the form but I can't put the name of the buyer and the number of books in the email. F.ex : Hello "John", you gonna receive your "3" books in a week.
I've tried something like this :
function sendEmail(e) {
var formreponse = e.responses;
var itemreponse = formreponse.getItemResponses();
var number= itemreponse[5].getResponse(); //because it's in the 5th columns of the spread sheets
var name= itemreponse[3].getResponse();
And then I just write a simple code like this
var TextToSend = "blablabla" + name + " blabla" + number + ".";
GmailApp.sendEmail(emailTo, subject, TextToSend, options);
But I've got an error message:
Cannot read property 'responses' of undefined.
And I don't know why!
It's very frustrating for me not to be able to finish this simple task.
Issues:
When running this function manually, through the editor, no event object is passed, and so e is undefined. You should not run this function manually.
responses is not a valid Event property of Form submit triggers.
Solution:
Install an onFormSubmit trigger, either manually or programmatically, so that the function will run automatically when the Form is submitted, and e will be populated.
Change e.responses to e.response:
var formreponse = e.response;
Reference:
Event Objects > Google Forms events > Form submit

Access 2010 - Unlock form during OnError Event Procedure

I have a form with multiple required fields. I have error handling in my Save function to handle when one of these fields is empty, so the user only recieves the error (error 3314) when trying to save the record (This handling has no problems and works fine by itself).
However, sometimes (usually if a required field has been "dirty" and then cleared) a Form error 3314 occurs, which doesn't let you click anywhere until you've typed something into the field.
I tried to ignore this error by setting form's OnError property to the following event procedure:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const conBlankField = 3314
If DataErr = conBlankField Then
Response = acDataErrContinue
End If
End Sub
According to other resources I've found, acDataErrContinue is supposed to ignore the error, but it doesn't seem to do so. While it does prevent the default Access error message from popping up, the form is still "locked" until something is typed into the field.
Is there a way to force the form to ignore this error completely, so error 3314 is handled exclusively by the error handling in my Save function?

Altering a Drupal form after validation

I have a Drupal 7 form where after submitting it, some validation happens. It is taking the email address and doing a database look-up to see if that user already exists. If the user exists, I need to alter the form that re-renders on the page that normally displays the errors, removing some fields. Basically on the error page, regardless of any other validation errors they would have normally received (First name required, last name required etc.) they would only get one error message that says "that email address is already in the system" and then I no longer want to display ANY of the other fields at this point except the email address field and a file upload field. So I'm having trouble trying to figure out how to alter the form after the first submission based on some validation.
Thanks
What you want to do is add some data to the $form_state variable in your validation function that can inform your form function as to what fields it should provide.
Untested Example:
function my_form($form, &$form_state){
$form['my_field1'] = array('#markup' => 'my default field');
// look for custom form_state variable
if ($form_state['change_fields']) {
$form['my_field2'] = array('#markup' => 'my new field');
}
}
function my_form_validate($form, &$form_state){
// if not valid for some reason {
form_set_error('my_field1','this did not validate');
$form_state['change_fields'] = true;
// }
}

Passing Keyboard event not working iOS simulator/device from WebDriver

Scenario:
- We have registration form that checks for errors via AJAX
- Fields are: email, confEmail, fname, lname, pwd, confPwd
- Error check happens when user enters in "email" field and tabs to "confEmail" field. Same for "pwd" and "confPwd" field
- I am trying to write automation script that mimics user behavior where user will enter "test" in "email" field and then tab to next field which is "confEmail". This should invoke AJAX check and throw error about "invalid email address"
Test configuration:
- Test written in Linux
- Running in iPhone simulator on Mac (of course)
This piece of code enters email address:
driver.findElement(By.cssSelector(Locators.getLocator("mobilebuy->emailAddressField"))).sendKeys("test");
Since sendKeys will not move focus away from that field, I then send TAB/click to next field so that the AJAX fires up. Apparently, doing that doesn't work. The AJAX never fires and no error message shows up. I can see when I simulate this manually in iPhone simulator, it works.
This should tab to next field:
driver.findElement(By.cssSelector(Locators.getLocator("mobilebuy->emailAddressField"))).sendKeys(Keys.TAB);
OR
This should click on next field which should fire AJAX:
driver.findElement(By.cssSelector(Locators.getLocator("mobilebuy->confEmailAddressField"))).click();
ANY IDEA ON HOW TO PROCEED WITH THIS ISSUE? I LOOKED THROUGH IT CLOSELY AND EVEN TRIED TO PASS IN UNICODE FOR "TAB" KEY BUT THAT DIDN'T WORK EITHER.
First of all, only the FirefoxDriver supports Action class (according to http://code.google.com/p/selenium/wiki/TipsAndTricks), but you should also expect support for the InternetExplorerDriver too.
Got this to work using following steps:
- I have a Type method which types items into the form
- Thereafter, I send a click to the field that fires Ajax using Action class and that seemed to work
// (WebDriver, email, confEmail, fname, lname, pwd, confPwd)
TypeRegistrationData(driver, "test/tester#com", "", "", "", "", "");
// action builder that tabs to next field
WebElement we = driver.findElement(By.cssSelector(Locators.getLocator("buy->emailAddressField")));
Actions builder = new Actions(driver);
builder.click(we); // this fires up the ajax that is expected
Try using Actions chain
Actions builder = new Actions(driver);
builder.keyDown(Keys.TAB).keyUp(Keys.TAB);
builder.build().perform();
If I were really desperate I would try to use sendKeys not necessarily on the text fields but on some parent element (could be even on body itself).