473,729 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validation of drop down menu and radio from dynamic display form

22 New Member
Hi anybody. I am newbie here and would like to know that how can I validate both drop down menu and radio button from a dynamic display form.Something went wrong with my script.The radio button is dynamic,however drop down menu is static.

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript" type="text/JavaScript">
  2. function formSubmit(obj)
  3. {
  4.     var returnStatus = 1;
  5.  
  6.     if (obj.rNumber.selectedIndex == 0 || 
  7.         !(movieList.time[<?php echo $rows['name'];?>].checked)) { 
  8.         alert("Please select!");
  9.         returnStatus = 0;
  10.     };
  11.  
  12.   }
  13. </script>
  14.  
  15.  
[PHP]
<?
if (isset($_SESSIO N['gmemberid'])) {

$tbl_name = "movie";
$result = mysql_query(spr intf('SELECT name,category,s creeningTime FROM %s
LIMIT 7', $tbl_name)) or die('Cannot execute query.');


//$numrow = mysql_num_rows( $result);


while ($rows = mysql_fetch_ass oc($result)) {
echo '<table width="100%" border="0"><tr> <td height="68">
<table width="100%" height="47" border="0">
-------------------------------------------------------------------<br>';

echo '<strong>' . $rows['name'] . ' (' . $rows['category'] . ')
<br></strong>';
foreach (explode(',', $rows['screeningTime']) as $time) { ?>
<label>
<input type="radio" name="time[<?php echo $rows['name']; ?>]"
value="<?php echo $time; ?>">
<?php echo $time; ?>&nbsp;&nbsp;& nbsp;
</label>
<?php } ?>
<?
}


}
?>

[/PHP]

[HTML]
<input name="request" type="submit" id="request" value="Submit Request" onClick="formSu bmit(document.m ovieList)">
[/HTML]
Sep 23 '07 #1
2 4337
Atli
5,058 Recognized Expert Expert
Hi vinceboy. Welcome to The Scripts!

I don't see any code for a dropdown menu. The code for the radio buttons looks ok tho.

One minor concern tho.
You use explode() on a the data returned by your database. As a rule, no field in you database should contain more than one piece of data. This is the first (1NF) of three rules you should always keep in mind when designing a database. You can read more about them in this article: Normalisation and Table structures .
Sep 23 '07 #2
vinceboy
22 New Member
The drop down menu is static display
[HTML]
<select name="rNumber" id="select4">
<option selected>Select </option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
</select>
[/HTML]

At this moment, I need to know whether any what went wrong at that validation while PHP mix up with Javascript.Than ks for your generious help
Sep 23 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1653
by: LRW | last post by:
I've a page where I have two form drop-menu. I need the second menu to populate only with items based on what's selected in the 1st menu. I have "Javescript in Easy Steps" and the closest it discusses is populating list content based on a radio button, but the book is so badly written, I'm having a horrible time trying to adjust using two menus. I did a Google for the sublect, and found http://www.blazonry.com/javascript/js_menu.php...
5
2610
by: EviL KerneL | last post by:
Hi - I am trying to figure out a way to enforce the validation included for this form based on whether the user chooses "email" or "phone" as the contact choice. Right now it is set to enforce validation on both. Is there a way to link the drop-down choice to the correspondent validation section while disabling validation for the other one? here's what I presently have:
4
5778
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
7
3614
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
2
3668
by: pantagruel | last post by:
I have an old web application I did where browsers with dynamic capabilities received a drop down menu on the top of the page and a fold out on the left hand side of the page and non-dynamic browsers received two static menus. This was done via server side detection of browser capabilities and branching the application. Over time needless to say the capabilities between the dynamic and static sides got seriously out of whack. Now the...
2
2467
by: tpaulson | last post by:
I have a couple of DIV's that I hide/display based on radio buttons. On the DIV's, I have multiple drop down boxes. The source shows that they are populated, but I can't make them drop down. Only click on the Unplatted Radio button, the rest isn't functional, yet. Any ideas how to make these drop down in FF. This works in IE. Here is the code: <HTML> <HEAD> <TITLE>Door County Register of Deeds - Tract Inquiry</TITLE>
6
8303
by: mcgrew.michael | last post by:
I hope this is the right group. I am very new to ASP so this is probably a stupid question. I have some vbscript that query's AD and populates a recordset. I know the recorset contains the information I want by doing a Response.write. I am having problems dynamically creating a drop down list from the data in the recordset. The drop down is created but it is empty. Any help would be greatly appreciated. A sample of the code: <% 'On...
0
1545
by: Steve Funk | last post by:
All, I have searched all around and have not yet found the answer to this nor a solution. Hopfully it will be easy to overcome. Here is what I am trying to do: I'm trying to build a wizard form completely dynamic. I'm adding the labels, textboxes, drop downs, radio buttons, etc dynamically. I am able to add them via Page Init. Which seems to re-add every time a button or post back is initiated. Don't know if this is the problem.
1
1618
by: lilbit02 | last post by:
Hi, I have a form that utilizes validation as most do via javascript. This form worked totaly fine until I needed to add a dynamic div now the validation doesn't work. It does work for the first dropdown but nothing there after. I always get the error saying is null or not an object. I need help trying to figure out how to access the ojects in this form. Now in my body I have a <form> and it's name is form1 and I also have another <form>...
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.