Formvalidation conditional on checkbox

I have a form (payment) where users enter creditcard information. All fields are required.
Except
Some users may choose to have their credit card information collected by phone.
In that case, they check a Checkbox (input name="Later" type="checkbox" id="Later" value="Ph")
How do I make the validation conditional on the checkbox not being checked?
This is my validation Script:
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');

Just have the user disable javascript to circumvent the required form fields.

Similar Messages

  • Conditionally checking checkboxes

    Hi.
    I need a checkbox for which the checking operation is conditional -- in certain illegal states of the containing frame and its components none of the checkboxes should change their state. I do not want to use checkbox.setEnabled(false). The changeListener does not sound good either.
    (Also I had to prevent combobox popup from appearing on same conditions. I was able to solve that by implementing my own ComboBoxUI with show() method modified. I can't think of a similar approach for the checkboxes at the moment.)
    Any ideas how to do it?

    That sure is an interesting link, rkconner, thank you, I think I'll need to read something like this soon.
    As for current case -- I have a really complex page (lots and lots of them, actually), with some fields disabled, and others enabled. Some fields need verification and the focus (generally) should not be able to leave such field unless the field value is legal. The legality is determined by querying a remote database.
    When I click an enabled checkbox, the verify() method for recently focused field starts. If the remote query returns negative response, I shouldn't be able to change the checkbox value, until the recent field is considered legal. So, I can't use setEnabled(false) for the checkbox, because, when I change the illegal value to a legal one, the checkbox should become changable instantly. I mean, I should be able to launch the verification process by clicking the checkbox.
    That's why I'm looking for another solution. Still looking :)

  • Generating a list depending on the condition of checkboxes

    I have a table with a list of items with a checkbox next to each of them. On a second table I'd like items from the first table to appear if they are checked off. Below is an screenshot of the result I'd like.
    I apologize if this question has already been answered, I spent an hour looking and couldn't find an answer. I suspect it has something to do with VLOOKUP but I can't figure it out for the life of me.

    noafe wrote:
    I have a table with a list of items with a checkbox next to each of them. On a second table I'd like items from the first table to appear if they are checked off. Below is an screenshot of the result I'd like.
    What you're looking for is a 'breakout table'.
    See my post at the end of this discussion from last September.
    A search of this forum for 'breakout' over the last year will bring up other examples.
    Regards,
    Barry

  • Problems with Checkbox as condition

    Masters,
    I would like to know what I am missing here (not inspired at all).
    I am trying to pass a value via BAPI using a checkbox as a condition. I mean when I checkbox my numeric field woulbe multiplied by -1 (makes my number negative).
    At the line between my table and my BAPI, in @numberfield assign value, I am using a condition but I am missing something.
    My condition: IF(@CHECKBOX==true,@numberfield*-1,@numberfield)
    Keeps saying the expression is wrong. I know but where? It has to do with Boolean of my checkbox?
    Regards,
    Gilson

    Gilson
    You are right. It most probably has to do with the data type expected by the field receiving your condition.
    I tried creating a form with three fields one bool checbox, one input field (numeric) and one expression box (also numeric).
    For the expression box I used the same formula you used, but since it's a numeric field I had to wrap it in a NVAL() statement to make it numeric.
    All if-then-else statements return textual values.
    NVAL(IF(@BOOL1==true,@NUM2*-1,@NUM2))
    It works!
    Henning Strand

  • PO Conditions double

    Hi all,
    I am facing a problem while creating POs.
    I have some header conditions which gets distributed to line items after saving.
    For 1st PO everything works fine. But when I create 2nd PO after that all the conditions get copied from 1st PO.
    So header conditions also getting copied in line item. If any other user again enter header conditions they also getting copied to line item.
    For Ex.
    FRA4 is a header condition. Which is getting copied to line item.
    In 2nd PO it appears as a line item too without doing any header entry. If I again enter FRA4 at header level then again it copies from header to line item and one more condition is getting added as FRA4 so I have 2 FRA4 conditions in one item.
    So I want to check that no conditions should be repeated in any line item.
    How can i stop that.
    Thanks & Regds,
    Sachin J

    Hi,
    Was the ''Group Condition'' indicator checkbox flagged for your condition type in M/06 transaction?.  Was the ''Group Condition Routine" field assigned with any value?
    Cheers,
    HT

  • How do I apply a calculation to row of cells

    Hi.
    I'm using iwork '08 and can't find a way to add a value to row of cells, as per the Calculate menu in Appleworks. I'm trying to update a calendar from the previous year by adding a value of 1 or 2 to the numbers in all the cells so that last year's June 24 becomes this year's June 25. Does Numbers have a way of doing this?

    wonderlips wrote:
    Hi Barry,
    Wow! Your responses to my problem makes a lot more sense when I can see the graphics you sent with them. Not sure what I was looking at, but it didn't contain the screenshots. Below is a representation of what I'm trying to accomplish. (Sorry, but I don't know how to provide a screenshot of the actual doc in this post.)
    Screenshots are taken using shift-command-4, then dragging the crosshair cursor to enclose the part of the screen you want to copy. The file is copied to your desktop as a PNG (portable network graphics) file named Picture 1 (with numbers ranging from 1 to 10), which you can then go to the finder and rename.
    Upload the file to a picture storage site (there are many free ones on the 'net) and store it in an album there. For most sites, clicking on your image (or just moving the pointer over it) will give a list of codes to paste into a message to call that image.
    Use the one labeled HMTL. Copy the code, then paste it into your message.
    You can see an example of the code used by clicking Reply on any message here showing an image, then clicking the quote button ( ” ) to see the text and HTML codes in the message itself. (Click the discard and Cancel button below the message space if you don't actually want to reply to that message.)
    Hope the formatting doesn't completely go away when you get this.
    It does, pretty much. The forum software parses out multiple spaces. Still readable if the reader has an idea what it should look like, and more readable using the technique described above for seeing HTML codes in a message.
    Anyway I can't get the DATE or DAY functions to track properly between cells, because the DAY function converts text into a number,
    DAY() does absolutely nothing with text, except return an error message:
    "DAY requires a date but found a string instead."
    A cell containing a Date and Time value may be formatted to show only the date portion in any of the following forms:
    No matter which of those is visible in the cell, the cell does NOT contain a text string and does NOT contain a number. The cell contains a Date and Time value in which the Date portion is the value for the ninth day of February in the 2006th year of the common era.
    and the DATE function converts a date into a number, and the the two functions don't play nice with each other.
    Actually DATE works in the opposite direction. It constructs a date from three separate numbers.
    The syntax is DATE(year,month,day)
    DATE(2006,2.9) will construct the Date and Time value for February 9, 2006 and set the time value to 0:00:00 (midnight). Depending on the format set for the cell containing the function, the date will display in one of the forms shown in the list above.
    Once the DAY function converts a date into a plain number, it won't reset after 30 and 31. In fact it seems to treat any reference to that cell as a one.
    DAY does return a (plain) number in the range 1-31. If you add 1 to that +number+, you'll get a number in the range 2-32. If you add 1 to the +date+ that DAY extracted that number from, you'll get a number in the range 2-31, or if the new date is in the next month, you'll get the number 1.
    Now that I've seen the graphics that were supposed to come with your posts, it looks like the answer may be a set of reference cells in another table that I can hide from view in the printed form of my chart.
    There's no need for a second table just to get the day numbers in your example. You may need a LOOKUP table to convert the 1s to the shortened name of the current month, though, and that LOOKUP table can be placed on a second table.
    Here's my take on the problem as currently described. Description below.
    Column A contains the starting date in Cell A1. The format is set to display this date including the name of the weekday to ensure the calendar starts on a Monday. (Necessary because the weekday labels in row 2 are entered text, not constructed from the date information being placed on the calendar.)
    A5, and every 4th row after contains a formula that adds 7 to the date in the cell four rows above.
    =$A1+7
    B1 contains a formula that extracts the DAY (of the month) from the date in A1, plus a calculation that allows it to increment the date when filled into the columns to the right.
    =DAY($A1+COLUMN()-2)
    The desire to replace "1" in C1 with "Jun" (the shortened name of the new month) makes the formula a bit more complicated:
    =IF(condition,TRUE: do this,FALSE:do this)
    =IF(DAY($A1+COLUMN()-2)=1,LOOKUP(MONTH($A1+COLUMN()-2),Month Lookup :: $A$1:$A$12,Month Lookup :: $B$1:$B$12),DAY($A1+COLUMN()-2))
    condition: DAY($A1+COLUMN()-2)=1
    as above, the formula extracts the (adjusted) day number from the date in A1, then compares it with the number 1.
    If they're equal the comparison evaluates as TRUE, and the formula does this part:
    LOOKUP(MONTH($A1+COLUMN()-2),Month Lookup :: $A$1:$A$12,Month Lookup :: $B$1:$B$12)
    MONTH() returns the number of the month of the adjusted date in A1, then looks up that value (6) in column A of the table Month Lookup, and returns the corresponding text string ("Jun") from column B of that table.
    If the day number is not equal to 1, the comparison evaluates as FALSE, and the fomula does the last part:
    DAY($A1+COLUMN()-2)
    and returns the day number of the (adjusted) date.
    Constructing the tables:
    Month Lookup table
    Enter 1 in A1 and 2 in A2.
    Select both cells and drag the coltrol down to fill to row 12.
    Enter Jan in B1
    Select B1 and drag the control down to fill ro row 12 (Dec)
    Calendar table
    Enter a starting date in A1.
    Enter
    =IF(DAY($A1+COLUMN()-2)=1,LOOKUP(MONTH($A1+COLUMN()-2),Month Lookup :: $A$1:$A$12,Month Lookup :: $B$1:$B$12),DAY($A1+COLUMN()-2))
    in B1.
    Select B1 and drag the fill control right to fill B1:H1
    (See optional formatting below for adding colour to month names)
    Select B1:H1 and Copy
    Select B5 and Paste.
    Enter
    =A1+7
    in A5.
    Select A2:H5 (as shown in graphic above)
    Drag the control down as many rows as you need.
    Optional formatting
    The red month names on yellow backgrounds are created using Conditional formatting for the seven cells B1:H1 (and similar cells further down the table).
    If you choose to do this, it's best to do so where "See optional formatting..." is placed in the instructions.
    Select B1:L1
    In the Format bar above the tables, set the Text colour to red and the Fill colour to yellow. (This will change the colours in all cells in the row.)
    Open the Inspector and click the Cell Format button.
    Click the Conditional Format checkbox to check it. Click Show Rules.
    From the Choose a Rule popup, choose "Less than or Equal to" and enter 31 in the box that appears.
    Choose Black for the conditional text colour and white for the conditional fill colour.
    Continue with the instructions for Constructing the Tables.
    Regards,
    Barry

  • How to specify maximum No. of Sales Orders ?

    Hi SD Gurus,
    The problem is that I want to give my Customer a special discount for 1st 10 orders, after that the condition type will be deactivated from 11th sales order. Can u all tell me the process ?
    Regards
    Rajarshi

    Hi Rajarshi,
    You can do this with Condition Update function for a Condition type but it has the limitation of offering discounts only for a max. first 3 sales orders.
    In V/06 for your Cond type definition, select the 'Condition update' checkbox in Master data section.
    Then maintain record for this condition type in VK11.
    Within the condition record, choose Additional sales data.
    Enter the maximum number in the Maximum number of orders field. This field tells for how many sales orders that condition would be activated. Beyond this number, the cond type wud be deactivated (you can also mention MAx. value or max qty.)
    Save your record.
    To view the orders in which the condition record was used till date, within the condition record, choose Extras - Cumulative values.
    Thanks
    Arijeet

  • Sapscript - medruck  DEBUG

    I am doing a purchase order form in sap script , using a standard form Medruck and Print program SAPFM06P,
    i have tried to debug the script using activate dubugger in se71 and by setting a break point in the print program, i am not able to debug it in eiher of the ways.
    since it is background program, i cant do the dubugging .
    can u give me the steps , how to debug this purchase order form( which is background program ).
    thankx in advance.
    ravi.s

    Hi Rich,
    Need your Inputs on SAP Script Issue.
    Issue:
    In a Purchase order ME22n/mE23n  Item View->Condition Control->Checkbox(Print Price) needs to be activated as it is not working. It's a standard functionality.
    We are using customized script for PO Printing, At the time of customization we have somehow lost this functionality which has been recognised now, Client wants when "Print Price" Checkbox is checked then only the Amount should get displayed in the final output. If "Print Price" is Unchecked then Amount Should not be displayed on the final output.
    Please suggest the approach which i Should take to resolve this issue.
    Thanks In Advance..
    Vikas

  • How to add a new tab in Multiple Selections of Select Options

    Hello Experts
    I have a requirement where under the standard select options there is a button "Multiple Selections", when it is clicked there should be a new tab in which there will be a list of options generated based on some condition with checkboxs for the user to select.
    Need your help in implementing it.
    Thank you in advance.

    Hi Santosh Kumar,
               You just need to follow as what Max mentioned. Neverthless I shall provide you solution for the case which you mentioned.
    My Understanding ----
    CASE - You need to custom tab at seacrh helpl for Profit center [ as shown in the your screen shots]
    Solution -
    STEP 1 -You need to create a seacrh help which you need to display as in custom tab you required.
    STEP 2 - Figure out the seacrh help used for the standard data element.
    In your case  profit center, PRCTR --> uses collective search help PRCT.
    STEP 3 - Copy the standard search help PRCT into a custom one ,ZPRCT and include the custom search help which you have created in the STEP1.
    STEP 4 - Create a prorgam and use the search help which you created as match code object id
    Regards,
    Siva

  • Highlighting the most recent date in a row

    hi all
    I have a series of 5 dates in a row. I would like to be able to highlight only the cell containing the most recent date (in respect to the current date) in each row.
    There will be instances when there is no date in some of the cells.
    Thanks for the help in the past, this and the other forums are awesome.

    Jason is correct. It requires two tables.
    I had started experimenting with this last night, but an outage at my ISP prevented posting at that time.
    Conditional formatting of a cell depends on comparing the value in that cell with a fixed value contained in the rule; the rule itself cannot reference a different cell to pick up the comparison value. So you need to calculate a value in a cell on a second table, apply conditional formatting to that cell, and place it directly behind the cell containing the date to be highlighted.
    Example:
    Dates are in cells B7 to F7 of Table 1
    Cell H1 is used to select the maximum date.
    Table 2 is a single row table with no row or column header cells, and only 5 columns.
    Select Table 1, open the Inspector, and use the Table inspector to set Cell Background to “None”
    In Cell H1 enter: =MAX(B7:F7)
    Go Insert > Table > Plain
    Resize the new table (Table 2) to 1 row x 5 columns.
    In A1 of Table 2, enter: =DATEDIF(Table 1::B7,Table 1::$H7,"D")
    Drag the handle at the lower right of the cell to copy the formula into all five cells.
    Click on A1.
    Open the Inspector and choose the Cell Format inspector.
    Check the Conditional Format checkbox, then click Show rules...
    Set the rule to “Equal to... 0”
    Choose a Fill colour to serve as your highlight colour.
    Click on the next cell and repeat.
    When you have applied the rule to all five cells, close the Conditional Format dialogue.
    Choose all five cells. Open the Text inspector.
    Click on the colour well.
    Leave the text colour set at Black, but move the Opacity slider to 0%.
    Close the Inspector and the Colors dialogue.
    Select Table 2 and drag it into position covering the five cells with dates on Table 1. Use the Arrow keys to nudge it into exact alignment.
    Go Arrange > Send Backward to move Table 2 behind Table 1. Repeat until you can see the dates on Table 1.
    Regards,
    Barry

  • Checkbox Value in where condition of query

    Hi,
    I have a check box which shows values based on the LOV's . If i check on the checkbox the values that are selected on the check box must be used in the where condition to update the table.
    Please suggest me how to take the check box values.
    Am using the below methos to update but its not happening
    Declare
    old_cohort_name varchar2(500);           
    new_cohort_name varchar2(500);
    l_cohort_id apex_application_global.vc_arr2;
    begin
    l_cohort_id := apex_util.string_to_table(:P64_CASCADE_COHORT_NAMES);
    select cohort_name into old_cohort_name from study_cohort
    where cohort_id = :p64_cohort_id;
    select :P64_COHORT_NAME into new_cohort_name from dual;
    if old_cohort_name <> new_cohort_name then
    update study_cohort
    set      
    cohort_name = new_cohort_name
    where cohort_id = :p64_cohort_id and
    cohort_id = l_cohort_id; // here is the variable i am using when checkbox is checked
    End if;
    End;
    Please suggest me how to modify the code
    Tx
    Sudhri

    Hi Sudhri,
    where cohort_id = :p64_cohort_id and
    cohort_id = l_cohort_id; // here is the variable i am using when checkbox is checked If this is the code you are actually using, then the condition would only be met if l_cohort_id = :p64_cohort_id because you are using an AND condition over the same column in the where clause, so it will only return rows when both values are the same. Then, I think that it seems not to be working for you because :p64_cohort_id and l_cohort_id have different values, and no row is getting updated then. If the values you are selecting in your checkboxes are several ids of rows to update, besides the one with id :p64_cohort_id, then maybe the condition you need is something like this:
    WHERE cohort_id = :p64_cohort_id OR instr(l_cohort_id, cohort_id) != 0;Hope that helps.
    Regards,
    Sergio

  • In need of assistance using checkbox and conditional formats

    Hello,
    I'm trying to set up a command to meet the following:
    When I opt to use a checkbox format in say cell "G2" - I would like to setup a conditional format along the lines of...
    =IF G2 is TRUE (i.e. checked), then change the color of cell "A2" to some color.
    Can anyone help me with the line command for this?

    L.
    Seems like it should be easy, doesn't it? There are options to doing this, but none are exactly obvious. The problem for you is that conditional formatting is based on the content of the cell being formatted, not some other cell. A typical use is to, say, bold content over a certain limit, or make the display of a zero value invisible.
    In Numbers08, you have only a couple of options:
    Use an IF-test to alter your content, or use an overlay table or tables. The solution you pick will depend on whether the content was calculated or input directly. If the content was input from the keyboard, that's the most difficult situation since there is no equation to modify.
    So, do you want to change the color of the Text, or the Fill, of cell A2? And, how important is this formatting to you? If it involves extra columns or tables and a lot of fussing around, do you still think you need it?
    Jerry

  • How to Disable CheckBox for a Particular Condition

    Hi All,
    In my application, iam using one table having 5rows , with checkboxes,
    based on one condition i want to  make few checkboxes as default disable in the same table, and some checkboxes i shud make it as enable, so experts please help me how to disable some checkboxes.
    disable means even if we select it shud not get selected, like that is it possible,

    Hi Sushma,
    You can have one more attribute in the same node from where you are populating the table and bind this boolean attribute to the enabled property of your CheckBox.
    and by looping thriugh the table you can check for conditions and based on it set the Enability of the checkbox.
    for (int iRowsCount =0;iRowsCount < wdContext.node<name>().size();iRowsCount++)
    if (condition)
    // Disabling the Checkbox based on the condition
    wdContext.node<name>().get<name>ElementAt(iRowsCount).set<BooleanAttributeName>(false);
    Hope this helps!!
    Cheers,
    Arafat

  • How to disable a Checkbox with condition.

    Dear experts,
    I am doing a module pool program. My questyion is, the program has a checkbox. After certain process, let's say if it met a IF condition. This checkbox needs to be disabled. No matter the checkbox previously is ticked or without tick. The checkbox need to be completely disabled.
    Please advice how should I do it. As I have search in the forum for some time, but I could not get my answer.
    Appreciate if someone can help. Thanks in advance.

    Hi,
    3 problems.
    1. U r using lower case for check boxes screen name
    2. Screen-invisible is used to make data of the parameter invisible while typing eg: PASS WORD.
    3. What ever modification we are doing is over written in AT SELECTION SCREEN OUTPUT event.
    use screen input attribute as i told earlier.
    AT SELECTION SCREEN OUTPUT is analogous to PBO of
    Dialog program
    Check below modified code. It is working fine now.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      tt = 'Example'.
      chk1 = 'X'.
    AT SELECTION-SCREEN OUTPUT.
      IF radio1 EQ 'X'.
        LOOP AT SCREEN.
          CHECK screen-name = 'CHK2'.
          screen-input = 0.
          MODIFY SCREEN.
          EXIT.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          CHECK screen-name = 'CHK1'.
          screen-input = 0.
          MODIFY SCREEN.
          EXIT.
        ENDLOOP.
      ENDIF.
    AT SELECTION-SCREEN ON BLOCK b1.
      CASE sy-ucomm.
        WHEN 'R1'.
          IF radio1 = 'X'.
            CLEAR chk2.
            chk1 = 'X'.
          ELSEIF radio2 = 'X'.
            CLEAR chk1.
            chk2 = 'X'.
          ENDIF.
      ENDCASE.
    I hope u r clear now.
    Thanks,
    Vinod.
    Edited by: Vinod Reddy Vemuru on Jul 29, 2008 4:33 PM

  • Making Simple Checkbox column conditional

    I've created a tabular form, one of the columns is ideal for the new 'simple checkbox' type.
    However I don't always want to display that column.
    Whenever I make it conditional (eg Never), I get the error:
    ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    Is this a bug or am I dong something wrong?

    I've created a simple app to illustrate this issue:
    http://apex.oracle.com/pls/apex/f?p=21570:1
    user/pass =guest/human
    The app allows you to check each employee that is human (1,0)
    The problem is that if you try to change the condition of the column to 'never' (or anything other than always), you get an error.
    You can use the above user/pass to log into the workspace (pwright) to change the column and check that out.

Maybe you are looking for