Validation in checkboxes (beginner)
I have a form where user needs to tick a checkbox role. It works fine.
But I need to make a validation with an error message if user doesn't tick any checkbox. In a few words user must at least tick a check box.
My idea is a loop through the checkboxes. If at least one checkbox is ticked then it exists or else displays an error.
I am a beginner on this subject so any help is appreciated and I hope I have explained myself well.
Hello,
You could loop through the records like the following:
Firts_record;
Loop
if :blk.chkbox = 'O' Then
return ;
end if ;
exit_when :system.last_record = 'TRUE' ;
next_record ;
End loop ;
-- no box checked, raise an error
Message(...);
Raise form_trigger_failure ;But I'm sure another solution based on a calculated item would be more elegant...
Francois
Similar Messages
-
Spry Validation Select ultimate beginner
Hello to all,
I need help with the spry validation select thingy. Basically, I am not a programmer, so code stuff won't help me much. I need a bit of a walkthrough:
The problem:
1) I need 2 validation select boxes with about 10 choices each.
2) I need an activation button - that is, when the correct choices are selected, the user presses a button to take them to the right webpage.
3) I need the choices within each select box to (obviously) direct the user to a different page once the activation button is pressed.
My solution so far:
1) I can insert the 2 validation select boxes into dreamweaver, with what i think is the correct naming, etc. I can also set the 10 choices for each. I do not know what the "value" tab means in the "list values" button I use to name and set the number of choices.
2) I can insert the button as well (just insert, nothing else)
3) I am not able to link the 10 choices with anything - I simply don't know how to do that, and cannot find info about it. When I live preview my work so far I get 2 nice drop/validation boxes with 10 choices each, and a button. I now need to, given a specific choice and after the button is pressed, to take the user to a different webpage with information about the double selection they chose.
I hope the above is clear enough - in the end, I will have 100 seperate webpages that need to be linked to the choices (10 choices in one box times 10 choices in the other box), I just need a way to link those choices to the webpages. Any basic and non-code based help would be very appreciated,
Cheers,
PI need help with the spry validation select thingy. Basically, I am not a programmer, so code stuff won't help me much. I need a bit of a walkthrough:
You have got no hope!
1) I need 2 validation select boxes with about 10 choices each.
You have stated that you have already done this. The value of the select element can be found here http://www.w3schools.com/tags/tag_select.asp
2) I need an activation button - that is, when the correct choices are selected, the user presses a button to take them to the right webpage.
You have stated that you have already done this
Seeing that you have already done the above, these are no longer a problem. This leaves us with
3) I need the choices within each select box to (obviously) direct the user to a different page once the activation button is pressed.
For this we would need to see your markup in situ. Please supply a link to your site.
Gramps -
PHP Form Validation: Radio Buttons
Hey everyone -
I'm trying to do two things here with an addition to one of
my forms using
PHP.
1. Attempting to validate if one of the radio buttons has
been selected.
2. Displaying which radio button is selected once the page is
reloaded
(checking for validation errors). That is - if they've
selected a radio
button but didn't fill in the other area - I want the radio
button they've
already selected to be actually "selected" once the page
reloads.
Here is the series of radio buttons:
<input type="radio" name="subject" id="subject1" value="1"
/>
<label for="subject1" class="labelbold">I wish to
contact you regarding
website design</label><br />
<input type="radio" name="subject" id="subject2" value="2"
/>
<label for="subject2" class="labelbold">I wish to
report a technical
error</label><br />
<input type="radio" name="subject" id="subject3" value="3"
/>
<label for="subject3" class="labelbold">I wish to
report an error with the
copy</label><br />
<input type="radio" name="subject" id="subject4" value="4"
/>
<label for="subject4"
class="labelbold">Other</label><br />
This is how I'm validating my checkboxes:
if($_POST['confirmbox'] == false) $error[] = "Check the
Privacy Policy
Agreement Box";
However, using "false" doesn't seem to matter with the radio
buttons. So,
how can I get the radio buttons to validate that ONE was
selected and how
can I show that selected button on a page reload (I'm
thinking I may need to
dynamically generate the value=""....<?php...?>....?).
Thanks!
Shane H
[email protected]
http://www.avenuedesigners.com
=============================================
Proud GAWDS Member
http://www.gawds.org/showmember.php?memberid=1495
Delivering accessible websites to all ...
=============================================Hello there -
After no replies - I decided to strain my brain (ha-ha) - and
finally
figured out the solution to the problem.
For the curious - I added this to each <input...>
field:
<?php if($_POST['subject'] == "1") echo'
checked="checked"';?>
And then for each <input...> I changed the "1" to the
corresponding value
each field was given.
Have a wonderful night. :)
Shane H
[email protected]
http://www.avenuedesigners.com
=============================================
Proud GAWDS Member
http://www.gawds.org/showmember.php?memberid=1495
Delivering accessible websites to all ...
=============================================
"Shane H" <[email protected]> wrote in
message
news:[email protected]...
> Hey everyone -
>
> I'm trying to do two things here with an addition to one
of my forms using
> PHP.
>
> 1. Attempting to validate if one of the radio buttons
has been selected.
>
> 2. Displaying which radio button is selected once the
page is reloaded
> (checking for validation errors). That is - if they've
selected a radio
> button but didn't fill in the other area - I want the
radio button they've
> already selected to be actually "selected" once the page
reloads.
>
> Here is the series of radio buttons:
>
> <input type="radio" name="subject" id="subject1"
value="1" />
> <label for="subject1" class="labelbold">I wish to
contact you regarding
> website design</label><br />
>
> <input type="radio" name="subject" id="subject2"
value="2" />
> <label for="subject2" class="labelbold">I wish to
report a technical
> error</label><br />
>
> <input type="radio" name="subject" id="subject3"
value="3" />
> <label for="subject3" class="labelbold">I wish to
report an error with the
> copy</label><br />
>
> <input type="radio" name="subject" id="subject4"
value="4" />
> <label for="subject4"
class="labelbold">Other</label><br />
>
> This is how I'm validating my checkboxes:
>
> if($_POST['confirmbox'] == false) $error[] = "Check the
Privacy Policy
> Agreement Box";
>
> However, using "false" doesn't seem to matter with the
radio buttons. So,
> how can I get the radio buttons to validate that ONE was
selected and how
> can I show that selected button on a page reload (I'm
thinking I may need
> to dynamically generate the
value=""....<?php...?>....?).
>
> Thanks!
>
> --
> Shane H
> [email protected]
>
http://www.avenuedesigners.com
>
> =============================================
> Proud GAWDS Member
>
http://www.gawds.org/showmember.php?memberid=1495
>
> Delivering accessible websites to all ...
> =============================================
>
>
> -
If users enter the secret_word which coincides with the
session.secretWord then the form can continue and do its
validating. If not the form stops and the cfelse message is shown.
The cfif code is here:
<cfif form.secret_word EQ #session.secretWord#>
Thank you for your message.
<cfelse>
Sorry, the secret word you entered in the field does not
match the word in the image
Please hit your back button</cfif>
My actionpage is here and I would be very greatful if someone
could show me where the cfif should go. Thanks:
<cfinclude template="topnav.cfm">
<!--- Must create this default structure or we pull an
error --->
<cfparam name="session.contact_nfo" default="">
<cfif NOT IsStruct(session.contact_nfo)>
<cfset session.contact_nfo = StructNew()>
</cfif>
<!-- Now we create default variable using cfparam -->
<cfparam name="Form.terms" default="NO">
<cfparam name="session.contact_nfo.Name" default="">
<cfparam name="Form.Country" default="">
<cfparam name="Form.City" default="">
<cfparam name="Form.Telephone" default="">
<cfparam name="session.contact_nfo.email" default="">
<cfparam name="session.contact_nfo.comments"
default="">
<!-- Now we clear the Session of any Values to allow us to
place our new form Values passed from our form page -->
<cfset StructClear(session.contact_nfo)>
<!-- Now we are placing our Form Values into the Session
-->
<cfset session.contact_nfo.terms= form.terms>
<cfset session.contact_nfo.Name= form.Name>
<cfset session.contact_nfo.email= form.email>
<cfset session.contact_nfo.comments= form.comments>
<!-- Now we are going to do our Error Checking first off
by creating a value of nothing for the variable we are calling
Errors -->
<cfparam name="errors" type="string" default="">
<!-- As we check for Errors if we find one we place it in
our List to display to our user making it easy for the end-user to
correct as they can see the error -->
<!-- Notice we are not validating the checkbox as it is
not a required form field -->
<cfif form.Name EQ "">
<cfset errors = errors & "<li>You Forgot to
enter your name!</li>">
</cfif>
<!-- Checking the email is a little more complicated so we
use a regular expression to check and see if there is a email
address and also is it formed properly -->
<cfif NOT
REFindnocase("^[-_!a-z0-9\.]+@([-_a-z0-9]+\.)+[a-z]{2,6}$",
email)>
<cfset errors = errors & "<li
class=""errors"">Your Email Address seems
incorrect?</li>">
</cfif>
<cfif form.comments EQ "">
<cfset errors = errors & "<li
class=""errors"">You Forgot to enter a comment!</li>">
</cfif>
<cfif errors NEQ "">
<!-- Here we are collecting the Error Message generated
by our code and placing them into a list for the user to see -->
<TABLE class="label1" WIDTH="300" BORDER="0"
CELLSPACING="0" CELLPADDING="0" ALIGN="Center">
<TR><P> <TD ALIGN="Left" VALIGN="Top">You
have some errors in your form submission, please try
again<br>
<cfoutput>#errors#</cfoutput></td></P>
</tr>
</table>
<!-- Also take note that the form action is now different
in that it is carrying the applications session with it which we
need to make our Application.cfm file work with the action. -->
<cfoutput>
<form method="post"
action="action_form.cfm?#session.UrlToken#">
<P><TABLE class="label1" WIDTH="300" BORDER="0"
CELLSPACING="0" CELLPADDING="0" ALIGN="Center">
<TR> <TD ALIGN="Left" VALIGN="Top">
<!-- This is how we place our session values into the
form field also important to note the because we used cfparam in
the start of this page to assign a default value of "" if there was
no value originally entered in the form than it will show no value
here. If we did not use the cfparam tag we would now show an error
as the session would go looking for a non-existant value -->
<P>Name: [*]<br>
<INPUT TYPE="Text" class="ftforminputsmall" NAME="Name"
SIZE="40" value="#session.contact_nfo.Name#"></P>
<P>Country:<br>
<INPUT TYPE="Text" class="ftforminputsmall" NAME="Country"
SIZE="40" value="#Form.Country#"></P>
<P>City:<br>
<INPUT TYPE="Text" class="ftforminputsmall" NAME="City"
SIZE="40" value="#Form.City#"></P>
<P>Telephone:<br>
<INPUT TYPE="Text" class="ftforminputsmall"
NAME="Telephone" SIZE="40" value="#Form.Telephone#"></P>
<P>E-mail: [*]<br>
<INPUT TYPE="Text" class="ftforminputsmall" NAME="Email"
SIZE="40" value="#session.contact_nfo.email#"></P>
</P>
<P>Comments: [*]<BR>
<textarea cols="40" size="40" class="ftforminputsmall"
rows="2"
name="comments">#session.contact_nfo.comments#</textarea></P>
<P>Booking dates:<br>
<P>From:
<select name="day" class="ftforminputsmall">
<cfloop from="1" to="31" index="i">
<option value="#i#"
selected="selected">#form.day#</option>
</cfloop>
</select>
<cfset monthList =
"January,February,March,April,May,June,July,August,September,October,November,December"
/>
<select name="month" class="ftforminputsmall">
<cfloop list="#monthList#" index="m"> <option
value="#m#"
selected="selected">#form.month#</option></cfloop>
</select>
<select name="year" class="ftforminputsmall">
<cfloop from="2006" to="2020" index="i">
<option value="#i#">#form.year#</option>
</cfloop>
</select>
</P>
<P>To:
<select name="dayto" class="ftforminputsmall">
<cfloop from="1" to="31" index="i">
<option value="#i#"
selected="selected">#form.dayto#</option>
</cfloop>
</select>
<cfset monthList =
"January,February,March,April,May,June,July,August,September,October,November,December"
/>
<select name="monthto" class="ftforminputsmall">
<cfloop list="#monthList#" index="m"> <option
value="#m#"
selected="selected">#form.monthto#</option></cfloop>
</select>
<select name="yearto" class="ftforminputsmall">
<cfloop from="2006" to="2020" index="i">
<option value="#i#"
selected="selected">#form.yearto#</option>
</cfloop>
</select>
<P>
<input name="Submit" type="submit"
CLASS="ftforminputsmall" value="Submit">
</P>
</table>
</form>
</cfoutput>
<!-- If no errors were detected we abort the previous code
and show the next code section -->
<cfabort>
</cfif></td></tr>Right I´ve put in the cfparams and the cfif at the top
of the page after the cfinclude.
However if the word is wrong the page still executes which it
shouldn´t. It is confusing with all the cfifs but if the
secret word is wrong the "sorry" message should be shown and the
page stops (maybe I need cfabort or cfexit?) The message is being
shown but the page continues. Here is the code:
<cfinclude template="topnav.cfm">
<cfparam name="session.secretWord" default="">
<cfparam name="Form.secret_word" default="">
<cfif form.secret_word EQ #session.secretWord#>
Thank you for your message.
<cfelse>
Sorry, the secret word you entered in the field does not
match the word in the image
Please hit your back button</cfif>
<!--- Must create this default structure or we pull an
error --->
<cfparam name="session.contact_nfo" default="">
<cfif NOT IsStruct(session.contact_nfo)>
<cfset session.contact_nfo = StructNew()>
</cfif>
<!-- Now we create default variable using cfparam -->
<cfparam name="Form.terms" default="NO">
<cfparam name="session.contact_nfo.Name" default="">
<cfparam name="Form.Country" default="">
<cfparam name="Form.City" default="">
<cfparam name="Form.Telephone" default="">
<cfparam name="session.contact_nfo.email" default="">
<cfparam name="session.contact_nfo.comments"
default="">
<!-- Now we clear the Session of any Values to allow us to
place our new form Values passed from our form page -->
<cfset StructClear(session.contact_nfo)>
<!-- Now we are placing our Form Values into the Session
-->
<cfset session.contact_nfo.terms= form.terms>
<cfset session.contact_nfo.Name= form.Name>
<cfset session.contact_nfo.email= form.email>
<cfset session.contact_nfo.comments= form.comments>
<cfparam name="errors" type="string" default="">
<cfif form.Name EQ "">
<cfset errors = errors & "<li>You Forgot to
enter your name!</li>">
</cfif>
<cfif NOT
REFindnocase("^[-_!a-z0-9\.]+@([-_a-z0-9]+\.)+[a-z]{2,6}$",
email)>
<cfset errors = errors & "<li
class=""errors"">Your Email Address seems
incorrect?</li>">
</cfif>
<cfif form.comments EQ "">
<cfset errors = errors & "<li
class=""errors"">You Forgot to enter a comment!</li>">
</cfif>
<cfif errors NEQ "">
<!-- Here we are collecting the Error Message generated
by our code and placing them into a list for the user to see -->
<TABLE class="label1" WIDTH="300" BORDER="0"
CELLSPACING="0" CELLPADDING="0" ALIGN="Center">
<TR><P> <TD ALIGN="Left" VALIGN="Top">You
have some errors in your form submission, please try
again<br>
<cfoutput>#errors#</cfoutput></td></P>
</tr>
</table>
<!-- basically the same form we used in form.cfm -->
<cfoutput>
<form method="post"
action="action_form.cfm?#session.UrlToken#">
<P><TABLE class="label1" WIDTH="300" BORDER="0"
CELLSPACING="0" CELLPADDING="0" ALIGN="Center">
<TR> <TD ALIGN="Left" VALIGN="Top">
<P>Name: [*]<br>
<INPUT TYPE="Text" class="ftforminputsmall" NAME="Name"
SIZE="40" value="#session.contact_nfo.Name#"></P>
<P>Country:<br>
<INPUT TYPE="Text" class="ftforminputsmall" NAME="Country"
SIZE="40" value="#Form.Country#"></P>
<P>City:<br>
<INPUT TYPE="Text" class="ftforminputsmall" NAME="City"
SIZE="40" value="#Form.City#"></P>
<P>Telephone:<br>
<INPUT TYPE="Text" class="ftforminputsmall"
NAME="Telephone" SIZE="40" value="#Form.Telephone#"></P>
<P>E-mail: [*]<br>
<INPUT TYPE="Text" class="ftforminputsmall" NAME="Email"
SIZE="40" value="#session.contact_nfo.email#"></P>
</P>
<P>Secret word: [*]<br>
<cfinvoke webservice="
http://www.easycfm.com/webservices/captcha.cfc?wsdl"
method="generateCaptcha"
returnvariable="easyCaptcha">
<cfinvokeargument name="height" value="100"/>
<cfinvokeargument name="YPos" value="20"/>
</cfinvoke> </P>
<P><cfset session.secretWord =
easyCaptcha.CAPTCHAWORD>
<cfoutput>
<img src="#easyCaptcha.IMAGE#"
border="0"></cfoutput></P>
<P><div="label1"> Please retype the Secret Word
in the field below. This is a simple security
matter to protect the information we receive through this
form.</div></P>
<P>
<INPUT TYPE="Text" class="ftforminputsmall"
NAME="secret_word" SIZE="40"></P>
<P>Comments: [*]<BR>
<textarea cols="40" size="40" class="ftforminputsmall"
rows="2"
name="comments">#session.contact_nfo.comments#</textarea></P>
<P>Booking dates:<br>
<P>From:
<select name="day" class="ftforminputsmall">
<cfloop from="1" to="31" index="i">
<option value="#i#"
selected="selected">#form.day#</option>
</cfloop>
</select>
<cfset monthList =
"January,February,March,April,May,June,July,August,September,October,November,December"
/>
<select name="month" class="ftforminputsmall">
<cfloop list="#monthList#" index="m"> <option
value="#m#"
selected="selected">#form.month#</option></cfloop>
</select>
<select name="year" class="ftforminputsmall">
<cfloop from="2006" to="2020" index="i">
<option value="#i#">#form.year#</option>
</cfloop>
</select>
</P>
<P>To:
<select name="dayto" class="ftforminputsmall">
<cfloop from="1" to="31" index="i">
<option value="#i#"
selected="selected">#form.dayto#</option>
</cfloop>
</select>
<cfset monthList =
"January,February,March,April,May,June,July,August,September,October,November,December"
/>
<select name="monthto" class="ftforminputsmall">
<cfloop list="#monthList#" index="m"> <option
value="#m#"
selected="selected">#form.monthto#</option></cfloop>
</select>
<select name="yearto" class="ftforminputsmall">
<cfloop from="2006" to="2020" index="i">
<option value="#i#"
selected="selected">#form.yearto#</option>
</cfloop>
</select>
<P>
<input name="Submit" type="submit"
CLASS="ftforminputsmall" value="Submit">
</P>
</table>
</form>
</cfoutput>
<!-- If no errors were detected we abort the previous code
and show the next code section -->
<cfabort>
</cfif></td></tr>
<!-- In this next section we can now take our form values
and do what ever we decide to do with them i.e. mailing them to
ourselves, placing them into a database, or a combination of both.
In this section it is wise to let the user know that his
information has been received as coldfusion has no way of letting
them know ---->
<cfmail server="" username="" password="" to="" from=""
subject="" type="">
<table><tr>
<td align="center" bgcolor="##006600"
class="ftbody"><span class="ftbody2"><strong
class="label1">Telephone:
</strong></span></td>
<td align="center" bgcolor="##006600"
class="ftbody"><span class="ftbody2"><strong
class="label1"><cfoutput>#Trim(FORM.name)#</cfoutput></strong></span></td>
</tr></cfmail> -
My Coding is missing something, can you help please?
i have three points in the following code which i can't work it out
import java.awt.*;
import java.awt.event.*;
import java.applet.* ;
public class Hangman extends Applet implements ActionListener, ItemListener
/* problems
* 1) should replace all occurences of letter not just 1
* 2) no of guesses should not be allowed to be <0
* 3) win/lose message should be in color
// CONSTANTS
private static final int EASY = 0;
private static final int MEDIUM = 1;
private static final int HARD = 2;
private static final int BEGINER = 9;
private static final int INTERMEDIATE = 8;
private static final int ADVANCED = 7;
private static final int ANSWER = 26;
private static final int RESET = 27;
private static final int STRING_NOT_FOUND = -1;
private String[][] WorkingArray = new String[][]{
new String[]{"CAT","WREN","MOUSE","GERBIL"},
new String[]{"ROSE","GRASS","WILLOW","RAGWORT"},
new String[]{"SHIRT","JACKET","SANDALS","TROUSERS"}
private Button[] Keys = new Button[28];
private CheckboxGroup Diff = new CheckboxGroup();
private Checkbox[] Levels = new Checkbox[]{
new Checkbox("Beginner",true,Diff),
new Checkbox("Intermediate",false,Diff),
new Checkbox("Advanced",false,Diff)
private Panel Keypad = new Panel(new GridLayout(4,7));
private Panel P = new Panel(new FlowLayout());
private Label Title = new Label("Guess The Word");
private Label Prompt= new Label ("Guesses Remaining");
private TextField Word =new TextField(24);
private TextField Message = new TextField(24);
private TextField Guesses = new TextField(3);
private String LongWord = " ";// Long Word
private String ChaGuess = " ";// Guessed Charactor
private String s = " " ;
private int[] Level_Values = new int[]{9,8,7,} ;
private int Pos = 0 ;
private int LPos = 0 ;
private int NoOfGuesses = 9;
private int NoOfChars = 0 ;
private int WordLen = 0 ; // length of current word
private int ArrayIndex = 0;// Array, currently in use
private int ElementIndex = 0;// element, currently in use
public void init() { // build gui and register components for events
this.add(Title);
this.add(Word);
this.add(P);
this.add(Keypad);
this.add(Message);
// add radio buttons to gui and register for events
for (int x = 0 ; x < Levels.length ; x++){
Levels[x].addItemListener(this);
this.add(Levels[x]);
public void start (){
validate();
public void stop(){
invalidate();
public void destroy(){
public void actionPerformed( ActionEvent Click){
int LastPos = 0 ;
try { // handle button events
if (Click.getSource() == Keys[RESET]){
// Hide Messages and clear TextFields
Message.setVisible(false);
Word.setText("");
LongWord = " " ;
// Enable Letters
for (int x = 0 ; x < RESET ; x++){
Keys[x].setEnabled(true);
}// for
// Get Word to Display
ElementIndex = (int)(Math.random()*4); // random no between 0 - 3
WordLen = WorkingArray[ArrayIndex][ElementIndex].length();
NoOfChars = WordLen ;
for (int x = 0 ; x < WordLen; x++){
LongWord = LongWord +"-" ;
} // for
Word.setText(LongWord);
NoOfGuesses = Level_Values[ArrayIndex] ;
Guesses.setText(LongWord.valueOf(NoOfGuesses));
} // if
else if (Click.getSource() == Keys[ANSWER]){
Word.setText(WorkingArray[ArrayIndex][ElementIndex]);
Guesses.setText(" ");
// Disable Letters
for (int x = 0 ; x < RESET; x++){
Keys[x].setEnabled(false);
}// for
}// else if
else{
//event came from a letter
// get object from awt.event, cast to button to use label
ChaGuess=( ((Button)Click.getSource()).getLabel() );
LPos = WorkingArray[ArrayIndex][ElementIndex].indexOf(ChaGuess) ;
Pos = WorkingArray[ArrayIndex][ElementIndex].lastIndexOf(ChaGuess);
if (Pos == STRING_NOT_FOUND){
--NoOfGuesses ;
Guesses.setText(LongWord.valueOf(NoOfGuesses));
if (NoOfGuesses == 0 ) {
Message.setVisible(true);
Message.setText("You Lose");
} //if
else {
if (LPos == Pos){
LongWord = (LongWord.substring(0,Pos )
+ ChaGuess + LongWord.substring(Pos+1,WordLen));
--NoOfChars;
LastPos = Pos ;
else {
LongWord = (LongWord.substring(0,Pos )
+ ChaGuess + LongWord.substring(Pos+1,WordLen));
--NoOfChars;
Pos = WorkingArray[ArrayIndex][ElementIndex].indexOf(ChaGuess,LPos+1) ;
if ( Pos != STRING_NOT_FOUND) {
LongWord = (LongWord.substring(0,Pos )
+ ChaGuess + LongWord.substring(Pos+1,WordLen));
--NoOfChars;
Word.setText(LongWord);
if (NoOfChars == 0 ) {
Message.setVisible(true);
Message.setText("You Win");
}// end of try block
catch ( Exception E ){ // catches all exceptions
finally {
invalidate(); // mark window as needing to be redrawn
validate(); // redraw window
} // actionPerformed
public void itemStateChanged(ItemEvent Check){
// handle checkbox events
if (Diff.getSelectedCheckbox() == Levels[EASY]){
ArrayIndex = EASY ;
else if (Diff.getSelectedCheckbox() == Levels[MEDIUM]){
ArrayIndex = MEDIUM ;
else if (Diff.getSelectedCheckbox() == Levels[HARD]){
ArrayIndex = HARD ;
Guesses.setText(s.valueOf(Level_Values[ArrayIndex]));
invalidate();
validate();
public Hangman() {
char Tit = 'A';
String ButtonTitle = "A" ;
// construct keyboard and register for ActionEvents
for (int Cnt = 0;Cnt< Keys.length ; Tit++, Cnt++){
ButtonTitle = ButtonTitle.valueOf(Tit);
Keys[Cnt] = new Button(ButtonTitle);
Keys[Cnt].setEnabled(false);
Keys[Cnt].addActionListener(this);
Keypad.add(Keys[Cnt]);
Guesses.setText(ButtonTitle.valueOf(NoOfGuesses));
Guesses.setEditable(false); // make TextField ReadOnly
Word.setEditable(false); // make TextField ReadOnly
Message.setVisible(false);
P.add(Prompt);
P.add(Guesses);
Keys[ANSWER].setLabel("Answer");
Keys[RESET].setLabel("Reset");
Keys[RESET].setEnabled(true);
}// Hangman1
you help is appreciatedChange
if (NoOfGuesses == 0 ) {
Message.setVisible(true);
Message.setText("You Lose");
} //if
to,
if (NoOfGuesses == 0 ) {
Message.setVisible(true);
Message.setForeground(Color.red);
Message.setText("You Lose");
for (int x = 0 ; x < RESET ; x++){
Keys[x].setEnabled(false);
}// for
} //if
set
Message.setForeground(Color.red);
for the You Win also -
CSS justifications are different when I upload my page...
I used to build websites with GoLive CS2 for number of years. With the purchase of a new laptop, I recently switch from CS2 to CS5. (But have been using CS4 at work). As GoLive is no longer existing, I just switch to Dreamweaver. I had several problems modifying pages originally created in GoLive and now imported in Dreamweaver, specially for modifying text already in place. It seems well suggested to learn CSS, maybe this will solve the problems.
Have been watching a few tutorials this morning on how to use CSS and I've spent a few hours building CCS for all the different options required by my document. Everything looked fined until I upload the page on the net. When text is centered in Dreamweaver once uploaded, everything is left-justifed. What am I doing wrong?
ORIGINAL PAGE
http://www.soulrebels.org/mighty_diamonds.htm
TEST PAGE – WITH CSS
http://www.soulrebels.org/mighty_diamonds_NEW3.htmIt's evident from your code that you haven't learned how to use CSS efficiently yet. And you don't yet understand how CSS works with HTML.
To further complicate things, your HTML code is riddled with inline styles that are overriding your embedded CSS rules. Best advice is to find a pre-built CSS Layout and rebuild your site without all the nasty GoLive code.
Some links to help you:
HTML & CSS Tutorials - http://w3schools.com/
How to Develop with CSS? (a must read)
http://phrogz.net/css/HowToDevelopWithCSS.html
Learn CSS positioning in 10 Steps
http://www.barelyfitz.com/screencast/html-training/css/positioning/
Code Validation Tools (for best cross browser results, check your code often and fix errors)
CSS - http://jigsaw.w3.org/css-validator/
HTML - http://validator.w3.org/
Beginner CSS Templates
Project VII's CSS Layouts (commercial products that perform well in all browsers)
http://www.projectseven.com/products/index.htm
Dreamweaver CSS Templates for beginners
http://www.adobe.com/devnet/dreamweaver/articles/dreamweaver_custom_templates.html
New DW Starter Pages
http://www.adobe.com/devnet/dreamweaver/articles/introducing_new_css_layouts.html
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb -
Column not set to default after insert
Hi,
I have a column defaulted to 'No', when I insert into table without providing value for that column thru SQL plus, column valued to 'No'. when insert thru APEX form, column is set to null. Any advise is appreciated.
Thanks
EugeneDid you solved your problem?
I have similar problem and question.
I have form with checkbox T/F. Checkbox has mandatory column (VALID) in underlying table with default value 'F'.
Table:
USER (firstname, lastname, valid)
If checkbox is visible on form, some value is inserted into the table.
But checkbox is conditionaly invisible for some users and when they want to insert new record APEX is generating insert statement (Automatic Row Processing (DML)) with all columns of the form and not only with visible columns.
This is generated insert:
insert into user(firstname,lastname,valid) values ('John','Baker',null) and it raises ORA-1400: cannot insert null into VALID because VALID can not be null.
Correct insert statement should be:
insert into user(firstname,lastname) values ('John','Baker') because VALID column is invisible for some users
I think that update statement do this (update only visible columns). -
A genious needed to figure out this code!!!!!
i have three points in the following code which i can't work it out
import java.awt.*;
import java.awt.event.*;
import java.applet.* ;
public class Hangman extends Applet implements ActionListener, ItemListener
/* problems
* 1) should replace all occurences of letter not just 1
* 2) no of guesses should not be allowed to be <0
* 3) win/lose message should be in color
// CONSTANTS
private static final int EASY = 0;
private static final int MEDIUM = 1;
private static final int HARD = 2;
private static final int BEGINER = 9;
private static final int INTERMEDIATE = 8;
private static final int ADVANCED = 7;
private static final int ANSWER = 26;
private static final int RESET = 27;
private static final int STRING_NOT_FOUND = -1;
private String[][] WorkingArray = new String[][]{
new String[]{"CAT","WREN","MOUSE","GERBIL"},
new String[]{"ROSE","GRASS","WILLOW","RAGWORT"},
new String[]{"SHIRT","JACKET","SANDALS","TROUSERS"}
private Button[] Keys = new Button[28];
private CheckboxGroup Diff = new CheckboxGroup();
private Checkbox[] Levels = new Checkbox[]{
new Checkbox("Beginner",true,Diff),
new Checkbox("Intermediate",false,Diff),
new Checkbox("Advanced",false,Diff)
private Panel Keypad = new Panel(new GridLayout(4,7));
private Panel P = new Panel(new FlowLayout());
private Label Title = new Label("Guess The Word");
private Label Prompt= new Label ("Guesses Remaining");
private TextField Word =new TextField(24);
private TextField Message = new TextField(24);
private TextField Guesses = new TextField(3);
private String LongWord = " ";// Long Word
private String ChaGuess = " ";// Guessed Charactor
private String s = " " ;
private int[] Level_Values = new int[]{9,8,7,} ;
private int Pos = 0 ;
private int LPos = 0 ;
private int NoOfGuesses = 9;
private int NoOfChars = 0 ;
private int WordLen = 0 ; // length of current word
private int ArrayIndex = 0;// Array, currently in use
private int ElementIndex = 0;// element, currently in use
public void init() { // build gui and register components for events
this.add(Title);
this.add(Word);
this.add(P);
this.add(Keypad);
this.add(Message);
// add radio buttons to gui and register for events
for (int x = 0 ; x < Levels.length ; x++){
Levels[x].addItemListener(this);
this.add(Levels[x]);
public void start (){
validate();
public void stop(){
invalidate();
public void destroy(){
public void actionPerformed( ActionEvent Click){
int LastPos = 0 ;
try { // handle button events
if (Click.getSource() == Keys[RESET]){
// Hide Messages and clear TextFields
Message.setVisible(false);
Word.setText("");
LongWord = " " ;
// Enable Letters
for (int x = 0 ; x < RESET ; x++){
Keys[x].setEnabled(true);
}// for
// Get Word to Display
ElementIndex = (int)(Math.random()*4); // random no between 0 - 3
WordLen = WorkingArray[ArrayIndex][ElementIndex].length();
NoOfChars = WordLen ;
for (int x = 0 ; x < WordLen; x++){
LongWord = LongWord +"-" ;
} // for
Word.setText(LongWord);
NoOfGuesses = Level_Values[ArrayIndex] ;
Guesses.setText(LongWord.valueOf(NoOfGuesses));
} // if
else if (Click.getSource() == Keys[ANSWER]){
Word.setText(WorkingArray[ArrayIndex][ElementIndex]);
Guesses.setText(" ");
// Disable Letters
for (int x = 0 ; x < RESET; x++){
Keys[x].setEnabled(false);
}// for
}// else if
else{
//event came from a letter
// get object from awt.event, cast to button to use label
ChaGuess=( ((Button)Click.getSource()).getLabel() );
LPos = WorkingArray[ArrayIndex][ElementIndex].indexOf(ChaGuess) ;
Pos = WorkingArray[ArrayIndex][ElementIndex].lastIndexOf(ChaGuess);
if (Pos == STRING_NOT_FOUND){
--NoOfGuesses ;
Guesses.setText(LongWord.valueOf(NoOfGuesses));
if (NoOfGuesses == 0 ) {
Message.setVisible(true);
Message.setText("You Lose");
} //if
else {
if (LPos == Pos){
LongWord = (LongWord.substring(0,Pos )
+ ChaGuess + LongWord.substring(Pos+1,WordLen));
--NoOfChars;
LastPos = Pos ;
else {
LongWord = (LongWord.substring(0,Pos )
+ ChaGuess + LongWord.substring(Pos+1,WordLen));
--NoOfChars;
Pos = WorkingArray[ArrayIndex][ElementIndex].indexOf(ChaGuess,LPos+1) ;
if ( Pos != STRING_NOT_FOUND) {
LongWord = (LongWord.substring(0,Pos )
+ ChaGuess + LongWord.substring(Pos+1,WordLen));
--NoOfChars;
Word.setText(LongWord);
if (NoOfChars == 0 ) {
Message.setVisible(true);
Message.setText("You Win");
}// end of try block
catch ( Exception E ){ // catches all exceptions
finally {
invalidate(); // mark window as needing to be redrawn
validate(); // redraw window
} // actionPerformed
public void itemStateChanged(ItemEvent Check){
// handle checkbox events
if (Diff.getSelectedCheckbox() == Levels[EASY]){
ArrayIndex = EASY ;
else if (Diff.getSelectedCheckbox() == Levels[MEDIUM]){
ArrayIndex = MEDIUM ;
else if (Diff.getSelectedCheckbox() == Levels[HARD]){
ArrayIndex = HARD ;
Guesses.setText(s.valueOf(Level_Values[ArrayIndex]));
invalidate();
validate();
public Hangman() {
char Tit = 'A';
String ButtonTitle = "A" ;
// construct keyboard and register for ActionEvents
for (int Cnt = 0;Cnt< Keys.length ; Tit++, Cnt++){
ButtonTitle = ButtonTitle.valueOf(Tit);
Keys[Cnt] = new Button(ButtonTitle);
Keys[Cnt].setEnabled(false);
Keys[Cnt].addActionListener(this);
Keypad.add(Keys[Cnt]);
Guesses.setText(ButtonTitle.valueOf(NoOfGuesses));
Guesses.setEditable(false); // make TextField ReadOnly
Word.setEditable(false); // make TextField ReadOnly
Message.setVisible(false);
P.add(Prompt);
P.add(Guesses);
Keys[ANSWER].setLabel("Answer");
Keys[RESET].setLabel("Reset");
Keys[RESET].setEnabled(true);
}// Hangman1
you help is appreciatedYou do not need a genious man! You just need somebody who is willing to do your work :)
-
Tabular form validation(Checkbox) is not working for Interactive report
Hi,
I am using the oracle apex 4.0 and oracle 11g.
I have written a below select query on interactive report as
select
apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
apex_item.text(3,RESNUM) as resnum
from "PDRRES"
and written the validation to display the error message( Function returning error text ) as
DECLARE
vRow BINARY_INTEGER;
BEGIN
-- apex_application.g_print_success_message := NULL;
FOR i IN 1 .. apex_application.g_f01.COUNT
LOOP
vRow := apex_application.g_f01(i);
apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
END LOOP;
END;
Output : No data found error message
As far as it work for sql report with above logic because apex built in row selector
but it fails in case of interactive report for some reason.
Please suggest.Saroj Nayak wrote:
Hi,
I am using the oracle apex 4.0 and oracle 11g.
I have written a below select query on interactive report as
select
apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
apex_item.text(3,RESNUM) as resnum
from "PDRRES"
and written the validation to display the error message( Function returning error text ) as
DECLARE
vRow BINARY_INTEGER;
BEGIN
-- apex_application.g_print_success_message := NULL;
FOR i IN 1 .. apex_application.g_f01.COUNT
LOOP
vRow := apex_application.g_f01(i);
apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
END LOOP;
END;
Output : No data found error message
As far as it work for sql report with above logic because apex built in row selector
but it fails in case of interactive report for some reason.
Please suggest.NO DATA FOUND usually occurs when an i mplicit select does not find anything. It can also occur when referencing a collection element that has not been defined.
You have 2 collectinons in the code you posted, apex_application.g_f01() and apex_applciation.g_f03. Since you are looping therough the COUNT attribute of g_f01 its reference ("I") is probably okay and the value store in vRow is probably not right. You can check this by using RAISE_APPLICTION_ERROR to see the value something like
raise_application_error(-20000,'vRow="'||vRo2||'"');Remember that working with checkboxes is tricky. If the box is not checked nothing will be sent. You may need to define a default value when no value is submitted. -
Problem with checkbox validation
actually i have a series of check boxes in jsp. on selecting any one check box and pressing delete it should go to a servlet and delete that value in database... i have 2 buttons in jsp..one is delete and other is add.
my jspcode:
<jsp:useBean id="userdetails" class="bean.Userbean" scope="session" />
<script language = "javascript">
function invoke(btn)
if(btn == 0)
if(document.subforums.subforum_title.checked)
document.subforums.action="/design/jsp/moderator/confirmdelete.jsp";
document.subforums.submit();
return (true);
var len = document.subforums.subforum_title.length;
for(i = 0 ; i < len; i++)
if(document.subforums.subforum_title.checked)
document.subforums.action="/design/jsp/moderator/confirmdelete.jsp";
document.subforums.submit();
return (true);
else
alert("please select any topic");
return (false);
if(btn == 1)
document.subforums.action="/design/jsp/NewQuestion.jsp";
document.subforums.submit();
return (true);
</script>
<html>
<head>
<title> questions</title>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<form name="subforums" method="post">
<body bgcolor="b2dfee">
<table>
<tr>
<td>
<center><font color="white"> this domain has <jsp:getProperty name="userdetails" property="subfCount"/> sub domains </font> </center>
</td>
<td>
<P ALIGN="right"<b><input type="submit" value="add a new topic" onclick="return invoke(1)"></p>
tr>
<td></td>
<td>
<P ALIGN="right"<b><input type="submit" value="delete topic(s)" onclick="return invoke(0)"></p>
</td>
</tr>
</td>
</tr>
<%
ArrayList arr =new ArrayList();
if(request.getAttribute("subforumlist")!=null)
arr=(ArrayList)request.getAttribute("subforumlist");
String subforname;
for( int i = 0; i < arr.size(); i=i++)
subforname=(String)arr.get(i);
userdetails.setSubforname(subforname);
%>
<tr>
<td valign=top width=100>
<input type="checkbox" name=subforum_title value =<%= subforname %>><%=subforname%>
</td>
</tr>
<%
%>
</table>
</body>
</html>
my problem is even if i select the checkboxes also, i get only the alert message printed...and its not entering the next page. hope am clear... plz help me...
Edited by: bad_programmer on Mar 25, 2008 10:25 PMAs mentioned above, the textbox would not get validated if it was empty.
Maybe I could create a function attached to the "required" attribute of the textfield's tag that was dependent on if the checkbox was checked or not?
Is this the best way? Surely there are better ways to do validation across components. -
Need code for this checkbox validation
There are 3 checkboxes on my form cb1,cb2,cb3.I need the code for the below validations..
if I check the checkbox cb1 then cb2,cb3 should be disabled(grayed, should not allow to
check). when i unchecked cb1 all 3 boxes should be enabled and then if i check cb2
then cb1,cb3 should be disabled.
At any point of time only one checkbox should be checked and
remaining 2 will be disabled/grayed.
hope its clear.
thanks in advance
DevenderHello,
You can enable/disable your check box items with the:
Set_Item_Property( 'item_name', ENABLED, PROPERTY_TRUE | PROPERTY_FALSE ) Built-in.
If Checkbox_Checked( 'chk1' ) Then
Set_Item_Property( 'chk2', ENABLED, PROPERTY_FALSE ) ;
Set_Item_Property( 'chk3', ENABLED, PROPERTY_FALSE ) ;
End if ;
...Francois -
Hi all,
I need to add two checkboxes as parameters , these two checkboxes refer to the fields in prps table . These fields in PRPS table are as well checkboxes.
Therez a Tcode CJ20n , i enter a project number and i go to 1st level WBS element and customer enhancement tab, I have twofields ZZLIMC and ZZLIMF these are check boxes .
Therez is a report which has a selection screen with select options as project number, month, year etc.
as checkboxes.
I need to add two more parameters ZZLIMC and ZZLIMF for this report as checkboxes, so when user selects either one checkbox or two checkboxes , for Eg: If user checks ZZLIMC, the report should validate only those project numbers with the field ZZLIMC checked ( ie equal to'X' ) Because in the selection screen of the report i have chosen ZZLIMC.
How do i proceed , please let me know.
regards,
Danfor the two check boxes ,
put the code in a perform to be validated .
hi there.
depending on the check box selection ,
give the appropriate perform .
put the perform in ,
if check box is not initial
perform1.
else.
perform2.
endif.
proceed this way.
vijay. -
Checkbox error "The Entered Value is Not on the List of Valid Values".
Hi All,
I have a check box attribute inside a node which is bounded to a field of type CHAR 1. I have given the property and value for the attribute as follows:
Attribute Name ZCHECK
Type assignment Type
Type ZTABLE-ZCHECK
Read-only 0
Default Value
Null Value 0
Input Help Mode Automatic
Determined Input Help ZCHECK
Type of Input Help Fixed values for domains
Formatting
Compression Default Value
I have created an onToggle Event for it.
Now when i execute my component i do the following.
First i click on a button called 'EDIT'. Now the check box comes to edit mode. Now when i click on the checkbox i get the following error. "The Entered Value is Not on the List of Valid Values".
When i try to debug, there is no problem in the 'INIT' method. The error is throw even before going inside the onToggle Event for check box.
Please explain how to over come this.Hi,
Check your field ZTABLE-ZCHECK, if it is of type CHAR1 then only possible values for checkbox should be 'X' and ' '.
May be your domain has some other values in Fixed Value List.
its better to bind checkbox with attribute of type boolean
Also, the input help for attribute bound to checkbox doesn't makes any logic.
Regards
Manas Dua
Edited by: Manas Dua on Feb 26, 2010 3:11 PM -
Hello,
I have to provide checkboxes validation. For this, I have few questions
1) How to group checkboxes together and in that able to select multiple options.
2) How to provide validation for the above checkbox group.
Can anyone help me in this regarding. Thanks in advance for your interest shown in solving this issue for me...................Hai.
check it may help you.
TABLES:MARA.
DATA:BEGIN OF GT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF GT_MARA,
GV_CB,
GV_CBV,
GV_LINES TYPE I,
INDEX TYPE I,
SY_INDEX TYPE I,
GV_LINES1 TYPE I,
MATNR LIKE MARA-MATNR.
SELECT-OPTIONS:S_MATNR FOR MARA-MATNR.
SELECT
MATNR FROM MARA
INTO TABLE GT_MARA
WHERE MATNR IN S_MATNR.
IF SY-SUBRC = 0.
DESCRIBE TABLE GT_MARA LINES GV_LINES.
ENDIF.
LOOP AT GT_MARA.
WRITE:/ GV_CB AS CHECKBOX,
GT_MARA-MATNR.
ENDLOOP.
CLEAR GT_MARA.
WRITE:'Total num of records is ',GV_LINES.
SET PF-STATUS 'DEL'.
AT USER-COMMAND.
IF SY-UCOMM = 'DEL' OR SY-UCOMM = 'PICK'.
DO 50 TIMES.
SY_INDEX = SY-INDEX.
READ LINE SY_INDEX FIELD VALUE GV_CB
GT_MARA-MATNR INTO MATNR.
IF GV_CB = 'X'." AND MATNR IS NOT INITIAL.
LOOP AT GT_MARA." WHERE MATNR = MATNR.
DELETE GT_MARA.
CLEAR GT_MARA.
ENDLOOP.
delete gt_mara index sy_index.
ENDIF.
ENDDO.
DESCRIBE TABLE GT_MARA LINES GV_LINES1.
WRITE:'Total num of records is ',GV_LINES1.
CLEAR:GV_LINES .
LOOP AT GT_MARA.
WRITE:/ GT_MARA-MATNR.
ENDLOOP.
ENDIF.
regards.
sowjanya.b -
Default Item Master Valid Checkbox
Hi Experts,
Is it possible to default the Valid checkbox (as checked) for all new items in the item master?
Thanks,
JaneHello Jane,
i dont think it is possible to make it default as checked since the valid tick box has a special function that Determines the validity period of an item master data.
hope this may help u.
Fidel
Maybe you are looking for
-
I have manually recreated my list of bookmarks in Firefox several times now only to come back (days) later and find they have disappeared. Probably related (but less concerning) is the fact that the browsing history also seems to have been cleared. M
-
One digit in customer number missing in Export to excel download
Dear All, We have a customized report for customer collection.The output of this report is as per desired. But when we download it to excel last digit in customer master is missing.That means say customer number is 1100051 while we export
-
FF-6 is not working for Bank statement View
Hi SAP Friends, Could you please tell me how we need to print the bank statement in FF_6, I have given then application type as 0001 and i have given the all the house bank and statement number and date, But i am not getting any statement in FF_6. I
-
HT2604 I can't instal software from applications instal DVD! please help me!
I can't instal software from applications instal DVD! please help me!
-
How to work wih kmdocumentation iview?
hi My requirement is need to display the different documents from the diff sap systems in portal side. for this which iview i have to use and wat is the procedure? i never work with km. plz let me know from the basic level? Thankyou