Alert box on condition
-
Problem:
I have a switch statement to check if form field names are empty. There’s one form that if it’s not empty, and it has an illegal file name (contains apostrphes, commas, etc…) I’d like to display a popup alert box telling them to use a different file name. I tried using this code below to create the alert box,echo '<script type="text/javascript">alert("Your message has been sent!");</script>';
and it took down my whole site.
More Info.:
I’m using the resume submissions and job postings plugin, and here is the code/psuedocode of what I would like to happenfunction formErrorCheck( $fields ) { $array = get_option( 'resume_input_fields' ); foreach ( $array as $item => $key) { switch($item){ case 'attachment': //if field is empty, error = true if ( !$fields['attachment'][0]['name'][0] && $key[1] == 1 ) $error = true; break; //else field is not empty, check for invalid characters and throw alert box if field contains invalid chars. else ( //parse field string for invalid chars if(invlid chars found) //throw alert box
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]
- The topic ‘Alert box on condition’ is closed to new replies.