Jump to content

lcy

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Everything posted by lcy

  1. Solved! Codes used as below function validateCB(theName){ var counter=0; var cb=document.getElementsByName(theName) for (i=0; i<cb.length; i++) { if((cb[i].tagName=='INPUT')&&(cb[i].type=='radio')){ if (cb[i].checked) counter++; } } if (counter==0) { return false; } return true; } function check(){ if (!validateCB('replacement')) { alert("Please fill in all the fields marked with *"); return false; } return true; }
  2. The link provided is not helping. The number of radio button here is not certain, depending on the result looped from database. I've tried something else using codes below. However, the message box displaying error pop out whenever I do not check the first radio button, which mean that I can just choose the first option. function check(){ var replacement = document.getElementById('replacement'); if (!replacement.checked) { alert("Please fill in all the fields marked with *"); replacement.focus(); return false; } } This code is working actually. If anyone here know how can I modify this codes to make it works better, your help is appreciated? Thanks.
  3. Sorry...because I'm using php for my system. And the javascript is just for validation part...so I posted it here. Sorry again...
  4. Hi all. I have some problems with radio buttons. Hope to get some help here. Thanks in advance. Here's the html: <?php while($row=mysql_fetch_array($result)) { ?> <input name="replacement" id="replacement" type="radio" value="<?php echo $row['date']; echo $row['title']; ?>" I need to validate if none of the radio buttons is checked using javascript. How can I do that? Any help will be appreciated. =)
  5. Thanks. I get what you guys mean
  6. Hi. I'm using php and mysql for a system. I have some questions on INSERT query. When we are using INSERT, in our query.... i. Is it necessary to include each field included in the table we are going to insert value with (though some of the field maybe do not inserted with value) ? ii. Have to follow the sequence of the fields in database table? Thanks in advance.
  7. Thanks for info provided. But i still don't get how should i do this export thing. Is it i need to download some codes for exporting .php files to those required files options, link them to my codes and that will do ...or what? Sorry for not getting what you guys mean because i don't have any single concept of this.
  8. Hello everyone! In my current project, i'm reqiured to export the summary report to other types of file extension, including html, pdf, xls, txt, csv, ods and sxc. The problem is that i don't know a single thing about this file exporting. Hope to get some information about file exporting here. And how should i start this task? Thanks in advance. Help is appreciated.
  9. i've solve my problem...Code that i used is from site below: http://codingforums.com/showthread.php?t=47082
  10. I've got the solution for the first problem... If anyone is having the solution for checking and unchecking all checkboxes, help is much appreciated!!
  11. Thanks for the solutions provided. I tried but they doesn't work. For the remained checking the checked checkbox, i've try another way and it's working. Is there any other way to solve my first and second problems? Anyway, appreciate solutions provided.
  12. Hi there. Hope to get some help with checkbox from you guys...thanks in advance. i have this as my checkboxes: Now I'm having three problems here: i. to validate if no checkbox is checked ii.to apply the check all and uncheck all function iii.after the checkboxes are checked and the button submit is checked, the page return to itself. Here i need the checked checkbos to be remained checked. How can i do all these with the checkbox i'm having. Appreciate any help given. Thanks again.
  13. Hi! Having some problems regarding radio buttons..hope to get some help here. Thanks in advance. Here's the code: $query = "SELECT * from replacement_leave WHERE a=1 && b=2 && c=3'"; $result = mysql_query($query) or die ("couldn't execute query"); <tr> while($row=mysql_fetch_array) { ?> <td><input name="replacement" type="radio" value="<?php echo $row['date']; echo $row['title']; ?>" checked></td> <td><?php echo $row['title']; ?></td> <td><?php echo date('d-m-Y',strtotime($row['date']));?></td> <td><?php echo $row['entitlement']; ?></td> <td><?php echo $left; ?></td> <td><?php echo $row['validity']; ?></td> </tr><? } ?> First, i need the radio button to be checked initially for the first value of the radio button. However, what i get is, the button is checked at the last item appears in the list of radio button. Second, after users make their choice and submit the form, they are able to return to this page. When they return to this page, the radio button is needed to be checked on the users' previously chosen button. But i don't know how to make this. Thanks again for helping.
  14. This is my table: (table.php) <? while ($row9 = mysql_fetch_array($result9)) { ?> <td width="7%" bgcolor="#FFFFCC">Company</td> <td width="18%" bgcolor="#FFFFCC">NRIC</strong></td> <td width="44%" bgcolor="#FFFFCC">Name</td> <td width="11%" bgcolor="#FFFFCC">Validity</td> <td width="15%" bgcolor="#FFFFCC">Update Validity</td> <td><? echo "".$row12['company_code']."";?></td> <td><? echo "".$row9['NRIC']."-".$row9['NRIC1']."-".$row9['NRIC2']."";?></td> <td><? echo "".$row12['name']."";?></div></td> <td><input type="text" name="validity_new" value="<?php if ($row9['validity'] != NULL){echo $row9['validity'];}?>" size="1" maxlength="3"></td> <td><div align="center"><input type="image" name="update_validity" value="<? echo "".$row9['NRIC']."-".$row9['NRIC1']."-".$row9['NRIC2']."";?>" src="Pictures/4.png" alt="submit button" width="20" height="20"/></div></td> Once the "Update Validity" button is pushed, the data is passed to "update.php". $validity_new = $_POST['validity_new']; In "update.php", the value of updated validity for only the selected row cant be retrieved. Only if value for validity for all the row in the table are changed to a same value, the updated value can be retrieved in the update.php. I just want to update validity for the row selected. How can i do this? Thanks a lot.
  15. Gd morning! I have a table diplaying a list of data which is called from the database (based on selection made earlier). I use "while($row=my_sql_fetch_array($result)" to call all data for that table. Now, i need to update one of the data field of the table for the chosen row only. I use text field to display the data to make it editable. Then i create a button for each row to pass all needed data and the updated data to the following page where update takes place. However, the ediited value only for that chosen row cant be grabbed and be passed to the next page. How should i solve this? Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.