Validating form by function

Hi,
i try to validate my form (items in them) with functions wich returns 1 or 0.
Here is one of the function:
create or replace
function firmennamecheck(        p_firmenname IN VARCHAR2
) return NUMBER
as
l_firmenname VARCHAR2(255);
BEGIN
l_firmenname := p_firmenname;
IF regexp_like(l_firmenname, '^[[:alnum:][:space:]]{2,80}$') OR l_firmenname IS NULL THEN
  RETURN 1;                                                                      
ELSE
  RETURN 0;
END IF;
end firmennamecheck; My problem is the whitespace. If I give an input of one whitespace in the text field, they returns 0 (this is ok!),
but if I insert more then one whitespaces in the text field, they also say, its ok!
Example:
' ' = no error message. (a big problem for mandatory items!)
'XYZ Inc' = no error message (how I want it!)
If I Use this expression:^[[:alnum:]]{2,80}$ then it's not more possible to insert text like 'XYZ Inc', because there is a whitespace.

Hi David,
so this is a form where user can register on my website. In this case it is a "dealer". They give information about comanpy name, first name, last name.....
And I want to validate this form.
Company name is "Name Ihrer Firma" and could contain numbers and letters.
In this case I use this Exp. '^[[:alnum:][:space:]]{2,80}$'.
Now its possible to type in letters and numbers also whitespace characters.
But the problem are the whitespace characters!
The user can type in a company name like " ". Just full of whitespaces! and the validation says "its okay!" and submit the page and the data gets inserted in the user table.
Result Example:
select * from user: shows me the user with a company name full of whitespace charactes!
Requirements:
1. Numbers, Letters and Whitespace charecters are allowed
2. Whitespaces not at the begin of the textfield
3. Only typing whitespaces without letters are not allowed!
David Gale I try your code, but its not working on the first time :-/
I think You forgot some [] more.
The finish reg. '^[[:alnum:]]{4,40}([[:space:][:alnum:]]{1,40})*$'But somethink works not fine. maximal 40 characters are allowed. I test it and type more then 40 characters in, sumbit it and without an error messages. :-/ this means, that the reg. is not 100% right! but whats wrong in the code?
Edited by: Mr.Nedo on 06.04.2011 05:56

Similar Messages

  • Validating forms in jsp using javaScript

    Hi all i'm trying to validate this form with javeScript. i was testing it with just the <input type=text name= file> first. it works but after the alert message it still posts to writeXML......
    i tried putting the fuction valid() after the <form> tag but it still posts it to writeXML.jsp.......can anyone help me please........What i want to do is make sure that something is typed in all the forms befor posting to writeXML..Thanx
    <html>
    <head> <title>Create MultipleChoice Questions</title> </head>
    <script language="JavaScript">
    function valid(form) {
         if(form.file.value == "")
         alert("Please enter the file name")
    </script>
    <body bgcolor="#cccccc">
    <% int count = 0;
    String number = request.getParameter("nOfq");
    int qNumber = Integer.parseInt(number); %>
    <form action="writeXML.jsp" method="POST">
    <center>
         <table bgcolor="silver" border="1" width="75%">
         <tr align="center"><td><b>Type in the Name of your Questionnaire here eg. BlackHistory.      Dont leave any spaces between letters</b><br>
         <textarea name="file" rows="1" cols="25"></textarea><br>
         </td></tr>
    <% for(int i=1;i<qNumber+1; i++) { %>
    <%count++;%>
         <tr align="center" bgcolor="#336699"><td><b>QUESTION <%= count %>: </b><br>
         </td></tr>
         <tr align="center"><td><b>ENTER QUESTION:</b><br>
         <textarea name=<%="questionText"+i%> rows="5" cols="65"></textarea><br>
         </td></tr>
         <tr align="center"><td><b>CHOICE 1:</b><br>
         <textarea name=<%="choice_1"+i%> rows="2" cols="50"></textarea><br>
         </td></tr>
         <tr align="center"><td><b>CHOICE 2:</b><br>
         <textarea name=<%="choice_2"+i%> rows="2" cols="50"></textarea><br>
         </td></tr>
         <tr align="center"><td><b>CHOICE 3:</b><br>
         <textarea name=<%="choice_3"+i%> rows="2" cols="50"></textarea><br>
         </td></tr>
         <tr align="center"><td><b>CHOICE 4:</b><br>
         <textarea name=<%="choice_4"+i%> rows="2" cols="50"></textarea><br><br><br>
         </td></tr>
         <tr align="center" bgcolor="#679995"><td><b>CORRECT ANSWER:</b><br>
         <textarea name=<%="cAnswer"+i%> rows="2" cols="50"></textarea><br><br><br>
         </td></tr>
    <% } %>
    <tr>
    <td align="center"><input type="submit" name="next" value="NEXTT" onClick="valid(this.form)">
    <td align="center"><input type="hidden" name="qCount" value="<%=count+1%>">
    </td></tr>
    </table>
    </center>
    </form>
    </body>
    </html>

    this Corrected code works perfectly
    <html>
    <head> <title>Create MultipleChoice Questions</title> </head>
    <script language="JavaScript">
    function valid(form) {
    if(form.file.value == ""){
    alert("Please enter the file name");
    frmValid.file.focus();     
    }else{
         frmValid.action="writeXML.jsp";
         frmValid.submit();
    </script>
    <body bgcolor="#cccccc">
    <% int count = 0;
    int qNumber=-1;
    String number = clearNull(request.getParameter("nOfq"));
    if(! number.equals(""))
    qNumber = Integer.parseInt(number);
    %>
    <form name="frmValid" method="POST" >
    <center>
    <table bgcolor="silver" border="1" width="75%">
    <tr align="center"><td><b>Type in the Name of your Questionnaire here eg. BlackHistory. Dont leave any spaces between letters</b><br>
    <textarea name="file" rows="1" cols="25"></textarea><br>
    </td></tr>
    <% for(int i=1;i<qNumber+1; i++) { %>
    <%count++;%>
    <tr align="center" bgcolor="#336699"><td><b>QUESTION <%= count %>: </b><br>
    </td></tr>
    <tr align="center"><td><b>ENTER QUESTION:</b><br>
    <textarea name=<%="questionText"+i%> rows="5" cols="65"></textarea><br>
    </td></tr>
    <tr align="center"><td><b>CHOICE 1:</b><br>
    <textarea name=<%="choice_1"+i%> rows="2" cols="50"></textarea><br>
    </td></tr>
    <tr align="center"><td><b>CHOICE 2:</b><br>
    <textarea name=<%="choice_2"+i%> rows="2" cols="50"></textarea><br>
    </td></tr>
    <tr align="center"><td><b>CHOICE 3:</b><br>
    <textarea name=<%="choice_3"+i%> rows="2" cols="50"></textarea><br>
    </td></tr>
    <tr align="center"><td><b>CHOICE 4:</b><br>
    <textarea name=<%="choice_4"+i%> rows="2" cols="50"></textarea><br><br><br>
    </td></tr>
    <tr align="center" bgcolor="#679995"><td><b>CORRECT ANSWER:</b><br>
    <textarea name=<%="cAnswer"+i%> rows="2" cols="50"></textarea><br><br><br>
    </td></tr>
    <% } %>
    <tr>
    <td align="center"><input type="submit" name="next" value="NEXTT" onClick="valid(this.form)">
    <td align="center"><input type="hidden" name="qCount" value="<%=count+1%>">
    </td></tr>
    </table>
    </center>
    </form>
    </body>
    </html>
    <%!
    private String clearNull( String sField ) {
    return ( sField == null ) ? "" : sField;
    %>

  • Check box w/validation form troubles

    hello there, I am under a major, major Deadline!
    I have a flash and php contact form with a validation made
    with all input text boxes. I need to add 1 check box to the form,
    but I don't know how to pass it to through.
    here is the code I have for my form now.
    function checkForm():Boolean {
    // this checks whether required fields have been filled in
    // initialize missing flag on assumption everything OK
    var missing:Boolean = false;
    // clear all error text fields
    error1_txt.text = error2_txt.text=error3_txt.text="";
    // check each field
    // if problem is encountered, display message
    // and set missing flag to true
    if (text_field_1.text == "") {
    error1_txt.text = "Please enter your name";
    missing = true;
    if (text_field_2.text.indexOf("@") == -1) {
    error2_txt.text = "Please enter a valid email address";
    missing = true;
    if (text_field_5.text == "") {
    error3_txt.text = "You have not entered any comments";
    missing = true;
    // if missing is true, return false
    // otherwise return true
    return missing ? false : true;
    function sendMessage():Void {
    // check whether form has been correctly filled in
    var formOK:Boolean = checkForm();
    // if no problems, process the form and send variables to
    PHP script
    if (formOK) {
    // Form processing goes here
    message.from = text_field_1.text;
    message.email = text_field_2.text;
    message.comments = text_field_5.text;
    message.sendAndLoad("feedback.php?ck="+ new
    Date().getTime(), messageSent);
    // display message informing user that email is being sent
    gotoAndStop("sending");
    function backToForm():Void {
    // send playhead back to the main form
    gotoAndStop("theForm");
    // create and apply text format for date
    var dateDisplay:TextFormat = new TextFormat();
    dateDisplay.font = "Georgia,Times,_serif";
    theDate_txt.setNewTextFormat(dateDisplay);
    theDate_txt.autoSize = "left";
    // create LoadVars instance to retrieve date from PHP script
    var getDate:LoadVars = new LoadVars();
    // initialize LoadVars to send form data
    // and receive response from the PHP script
    var message:LoadVars = new LoadVars();
    var messageSent:LoadVars = new LoadVars();
    // load date from PHP
    getDate.load("
    http://localhost/phpflash/ch02/today2.php");
    // assign theDate property of the LoadVars instance to text
    field
    getDate.onLoad = function() {
    theDate_txt.text = this.theDate;
    messageSent.onLoad = function() {
    if (this.sent == "OK") {
    gotoAndStop("acknowledge");
    } else {
    gotoAndStop("failure");
    failure_txt.text = this.reason;
    gotoAndStop("theForm");
    any help would be greatly appreciated.
    thanks,
    hutch

    if by check box you mean a radio button, you can add the
    following to your code:

  • Spry Validation form objects

    I have just been looking at the Spry validation form objects
    like the textfileds and the checkboxes etc, and I like what I see,
    but I wandered how I might deal with them once filled in and the
    form is submitted.
    Currently, I create forms manually and then use the Yaromat
    Validate form which I think is really good. I create asp pages, so
    I programme my email forms to be submitted by CDONTS. Once the form
    is submitted it is then sent to a thank you page where the CDONTS
    code is sitting, and is formatted into an email and sent to the
    relevant email addresses.
    If I chose to use Spry validation instead of the Yaromat
    Check form, do I just carry on creating the CDONTS code on the
    thank you page as I would do normally in order for the email to be
    sent?
    Thanks
    Mat

    You can specify addional error locations. See this example: http://labs.adobe.com/technologies/spry/samples/validationwidgets/Single_error_message_onS ubmit.html

  • In Service contract, to change the valid form date on service code level.

    Hi.
    I want to change the price valid form date on service code level ( i.e. in condition)  in Service contract.
    I know i can  do that with ME32 transaction but i have lot of Service contract with more then 10,000 line items
    Is there any way that i can change in mass based on Service contract no. wise.???
    Thanks in advance..
    Edited by: VIKRANT HANDE on Sep 15, 2009 9:11 AM

    Please check in KON* series table in SE16N transaction. I guess KOHN table may help you out. You can see other similar tables.
    In any one of the table you will find validity data.

  • Tracing Form and Function modules using SE30

    Hi,
      I want to trace only the Forms and function modules that are executed by a program using SE30. I have tried setting the variants in different ways but it still gives lot of junk information which i dont need. How can I set up the variant so that it only traces Forms and function modules executed by a program?
    Will give points to right answer. Thanks for reading

    Hi Srikrishna,
    First of all create a vraian tin SE30. While creating the variant, in th Tab 'Duratn/Type' select the radio buton 'NONE'. Now execute yur program and then analyse.Select 'GROUP HIT LIST' Icon which gives Function Modules,Subroutines etc.
    Regards,
    Srinivas.

  • Forms Folder functionality - Issue with layout not appearing properly

    Facing issue with forms folder functionality. Any ideas.. Please do help.
    I have placed folder fields on stacked canvas (CNV_MEA_LINES) which is on a tab page(CNV_MEA_TAB > MONTHLY_SCHEDULE).
    In WHEN-NEW_FORM_INSTANCE Trigger I have below code
    app_folder.define_folder_block
    (object_name => 'DEVELOPER',
    folder_block_name => 'XXDNB_BEN_ME_LINES',
    prompt_block_name => 'XXDNB_BEN_ME_LINE_PR',
    folder_canvas_name => 'CNV_MEA_LINES',
    folder_window_name => 'WIN_MULTIELEMENT',
    disabled_functions => 'TOOLS OPEN',
    tab_canvas_name => NULL,
    fixed_canvas_name => NULL
    At designtime, folder stacked canvas is looking good.
    At runtime, folder stacked canvas is completely coming till the end of tab page. Scrollbar is not appearing.
    Thanks in advance..

    This doesn't look like an Oracle Designer question. "App_folder" sounds like it has something to do with eBusiness Suite, right? If so, ask this in the EBS forum.

  • You do not have permissions to access a database that contains data required for this form to function correctly.

    I have dropdown on infopath form , and it receives data from sql server table ,  it works fine when i am running in preview mode , but when i am publishing form to sharepoint server and loading that form
    i am getting this
    You do not have permissions to access a database that contains data required for this form to function correctly.
    Can you please help?
    Thanks,

    try this one, if not yet
    Convert the data connection to UDC (store it in a Data Connection Library within the same site collection as the form library).  See if this works without any other changes, but if not, then...
    Manually edit your UDC file in Notepad (or your preferred editor) so that the authentication line is not commented out and so that it references the name of the SSO target app you created. 
    For Type, use NTLM.
    Ensure the user has rights to access the database
    Also ensure the connection file has been approved - A sharepoint admin can access a non approved Ucdx file. Go to the connection library and approve the file
    Also check this post having the similar issue:
    http://social.technet.microsoft.com/Forums/en-US/3196bafd-4bc3-40ab-ac2b-d149d1c3e0fa/sharepoint-2010-error-you-do-not-have-permissions-to-access-a-database?forum=sharepointdevelopmentprevious
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • How does Validated Form tag insert the error message?

    I'm using validated forms tags in my jsp and when there is an error in the form
    the error message is set to display on top of the wrong field. This is an attribute
    that I set in the <portlet:validatedForm> tag called "messageAlign", but I want
    to know how this is inserted or what I can do to line it up above the text field
    because it is moving all the elemnts around in the table cell. Any insight would
    be helpful.
    Thanks,
    Travis

    Hard to know what the cause is  because it's like this
    I know what I did to cause this. I upgraded my one of my hard drives, renamed the drive and moved the folder. The missing pictures it can't find were added with the option in the advance menu "copy photo to library" turned off.
    and this
    What I did is added a small SSD as my primary drive. Put the OS and all the apps on it.  Moved my iPhoto and iTunes libraries to an large external.  Most of the picture it is not having a problem wth.  Only certain ones.  Don't actually think I unchecked tha prefeence, but it's acting like i have.  
    seem to be written by two different people.
    This thread
    https://discussions.apple.com/thread/3216539?tstart=30
    has details on how one user hacked the SQL database to fix the issue. Not for the faint hearted. Back up first.
    Regards
    TD

  • How to iterate dyna validation form using jstl tag

    i have create dyna validation form in struts-config.xml
    <form-bean name="DynaValidationForm"
    type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="username" type="java.lang.String" />
    <form-property name="cityName" type="java.lang.String[]" />
    <form-bean>
    and i want to disply these value on my jsp by usig jstl tag
    <c:forEach var="form" item="${DynaValidatorForm.????????}">
    <c:out value="form.username">
    </c:forEach>
    but problem is item is of collection object And in dyna validation form
    how can i create the collection object or to call this .
    please help me

    posting the same question more than once won't
    increase your chances of getting an answer.
    sometimes nobody knows or no one is interested in
    putting in the time to figure out an answer. your
    question might be one of those.
    %sometimes I get the feeling that I'm actually helping someone do me out of a job.

  • Lazy form bean functionality in 8.1.4

    Hi All!
    Is there any functionality in Workshop 8.1.4 which similar to struts lazy form bean functionality? I can't find any doc or example or forum item about it.
    I need it to implement a functionality where my html form generated runtime and don't know in advance how many and what type of fields will it contain.
    Any suggestion should be highly appreciated!
    Thanks in advance!
    S.

    I can't be sure about exactly what's happening here, but I can point out several things.
              The class "javax.servlet.jsp.el.VariableResolver" is associated with JSTL 1.1.x, and JSP 2.0. It's not part of JSTL 1.0.x. Make sure you really have version 1.0.6, and don't have 1.1 somewhere.
              If you're just trying to use the JSTL, you shouldn't need several of those jars that you're presently including. You only need jstl.jar and standard.jar.
              Why are you using the "rt" versions of these taglibs? Those don't even use the expression language. I would remove "_rt" from all of those references.
              Note that if you're using Struts and the JSTL, you probably want to use Struts-EL, which is a version of the Struts jar that uses the EL to evaluate attribute values. Check the struts-user archive for some information about this. You'll find the struts-el distribution in the "contrib" directory of the Struts distribution.

  • HT1918 ? Valid forms of payment for iTunes in Kenya?

    I live in Kenya - iTunes will not accept my KCB debit card as a valid form of payment. I am using the same card successfully on Amazon, so why wont iTunes accept it?

    Lulu Clark wrote:
    ...... are you saying that it is not a valid form of payment for iTunes?
    Correct.
    The context of this thread implies iTunes.

  • Partial validation form

    Hi guys! In my project i need to submit a whole form but validate only part of it. I`m planning to develop partial validation form, custom button for the form, and validation zone (envelopes the components that will be validated). I`ll use the following example:
    http://forum.java.sun.com/thread.jspa?forumID=427&threadID=643655
    Any suggestions/discussions are welcome.

    As it signalled the page of Youtube, expected this answer, but like my knowledge in this matter is scarce, had to ensure me that the problem was not the browser or the absence of a package.
    Thank you for answering

  • Display error message in forms from function "verify_function"

    Hi,
    We have a number of users with our own created profile attached to them.
    We have enabled the 'PASSWORD_VERIFY_FUNCTION' for our own profile.
    Function "verify_function" is used to validate a user's password.
    In "verify_function" we have used "raise_application_error" message in case password validation fails.
    Example:
    raise_application_error(-20001,'Password must be minimum 8 characters in length and maximum 30 characters long');Question) "raise_application_error" displays the error message only in SQL Plus prompt. How do I display the same message from Oracle forms?.
    I have used DBMS_ERROR_TEXT & DBMS_ERROR_CODE in ON-ERROR trigger. This is not displaying the error message in forms in case validation failed in "verify_function". Oracle simply clears the username/password field with a new window. We want to display the error message that occured in "verify_function".
    Thanks

    use the following code in validating the item, e.g when-button-pressed
    begin
    verify_function;
    exception
    when others then
    message(sqlerrm);
    raise form_trigger_failure;
    end ;
    OR
    instead of writing a procedure rewrite it as a function to return 1 if password is correct or 0 if password is wrong
    Regards
    Jihad

  • Free form partner function field in Sales document header and item..

    Hello Experts,
    Is there anyway we can use the partner functions functionality in Sales document header and item level, so that we can enter a free form number in the Partner field? I mean is it possible to be able to enter a free form number WITHOUT getting validated against corresponding master data like Customer or Vendor master, Contact person, Personnel or User master records?

    Hi,
    It is not possible.
    Because partner function will be determined in the sales document header and item as per the configuration you have done in the partner determination.
    It is not possible to enter a number wihich is not created and assigned.
    Regards,
    Mullairaja

Maybe you are looking for

  • Icon Creation Question -- What format are custom shaped icons saved as?

    I have Adobe Photoshop CS and Adobe Illustrator CS. I am assuming that one of those are able to create custom shaped icon format images for using on Mac folders. I am able to save usable icons for folders as .psd format. However, they are always squa

  • I got a chance to jon as SAP B1 consultant. How will be future with SAP B1

    Hi, This is kiran.I completed  my MCA in the year of 2010. Last week i got selected for a company in Hyderabad as a ASSOCIATE CONSULTANT on SAP BUSINESS ONE mainly and the package is 7k for first 6m after that 1.3L I don't know how the software will

  • Not able to update organizations units in an infotype 0001

    Iam unable to update organizational units, positions through lsmw in an infotype 0001 if i do manually it is updating in 1infotype. Iam trying to run reports rhinteoo still not able to figure it out experts share your experience on this

  • Equipment Task List

    Hi PM Experts, I have a general doubt in PM task list. When I open a Equipment task list with transaction IA03, and go to the components assigned to an operation. There i can see  a field "Holder" ... can someone please explain to me what is this "Ho

  • Why are these SQL Exceptions coming?

    I have developed a web based application in which I am experiencing two exceptions coming after a periodic time. 1)Exception : java.sql.SQLException: ORA-01000: maximum open cursors exceeded 2)Exception : java.sql.SQLException: The url cannot be null