SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need Js for radiobutton validation

    my code is blow,,,
    1. If i select the first option i have validate first txt box (should hav 11 char).
    2. If i select the secondoption i have validate second txt box (not empty).
    Someone Plz Help

    <table width="100&#37;" height="56" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="24%" rowspan="2">Select Shipping Type </td>
    <td width="25%" valign="top"><div align="right">Blue Dart
    <input name="type" type="radio" value="B" />
    </div></td>
    <td width="2%" valign="top"><div align="center">/div></td>
    <td width="49%" height="22"><input name="billno" type="text" id="billno" style="WIDTH: 130px" onfocus="this.value=''"
    onclick="javascript:clearbox();" value="Enter Bill No" size="10" maxlength="60" /></td>
    </tr>

    <tr>
    <td height="22"><div align="right">Hand Delivery
    <input name="type" type="radio" value="H" />
    </div></td>
    <td><div align="center">/div></td>
    <td><input name="storeid" type="text" id="storeid" value="Enter Store Id" onfocus="this.value=''" onclick="javascript:clearbox();"/></td>
    </tr>
    </table>
    <p>&nbsp;</p></td>
    </tr>
    <tr>
    <td colspan="3" class="login_txt"><div align="center">
    <input name="rma" type="hidden" id="rma" value="<?php echo $rma; ?>" />
    <input type="submit" name="Submit" value="Submit" onclick="valbutton(myform);return false;" />
    </div></td>
    </tr>
    </table>
    <?php } ?>
    <p align="center">&nbsp;</p>
    </td>
    </tr></form>
    </table>
    </body>
    </html>

  2. #2
    SitePoint Wizard PHPycho's Avatar
    Join Date
    Dec 2005
    Posts
    1,201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First format your code with proper wrapper, then only request for help. Please do read the forum rules before proceeding.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Correct code Here


    <table width="100%" height="56" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="24%" rowspan="2">Select Shipping Type </td>
    <td width="25%" valign="top"><div align="right">Blue Dart
    <input name="type" type="radio" value="B" />
    </div></td>
    <td width="2%" valign="top"><div align="center">/div></td>
    <td width="49%" height="22"><input name="billno" type="text" id="billno" onfocus="this.value=''"
    onclick="javascript:clearbox();" value="Enter Bill No" size="11" maxlength="11" /></td>
    </tr>

    <tr>
    <td height="22"><div align="right">Hand Delivery
    <input name="type" type="radio" value="H" />
    </div></td>
    <td><div align="center">/div></td>
    <td><input name="storeid" type="text" id="storeid" onfocus="this.value=''" onclick="javascript:clearbox();" value="Enter Store Id" size="11"/></td>
    </tr>
    </table>

  4. #4
    SitePoint Wizard PHPycho's Avatar
    Join Date
    Dec 2005
    Posts
    1,201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Again the same mistake.
    Correct way:
    Code HTML4Strict:
    <table width="100%" height="56" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="24%" rowspan="2">Select Shipping Type </td>
    <td width="25%" valign="top"><div align="right">Blue Dart
    <input name="type" type="radio" value="B" />
    </div></td>
    <td width="2%" valign="top"><div align="center">/div></td>
    <td width="49%" height="22"><input name="billno" type="text" id="billno" onfocus="this.value=''"
    onclick="javascript:clearbox();" value="Enter Bill No" size="11" maxlength="11" /></td>
    </tr>
     
    <tr>
    <td height="22"><div align="right">Hand Delivery
    <input name="type" type="radio" value="H" />
    </div></td>
    <td><div align="center">/div></td>
    <td><input name="storeid" type="text" id="storeid" onfocus="this.value=''" onclick="javascript:clearbox();" value="Enter Store Id" size="11"/></td>
    </tr>
    </table>
    Better luck next time

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the mistake, i made? Can u denote it ?

    This is the code , which im using in my page

  6. #6
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should make you code clearly before ask

  7. #7
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rsmaha View Post
    What is the mistake, i made? Can u denote it ?
    TWO mistakes ...

    #1 You just copied your code into your post. What you NEED to do is put formatting around it so that it is easier to read. (Like PHPycho did using the [ HIGHLIGHT= "HTML4Strict"][/ HIGHLIGHT] formatting options).

    #2 You have simply asked for someone to write code for you. How is that a request for help? It's not - it's a request for service.

    Try writing Javascript code to do what you want, then when it doesn't work come back and ask for help in getting your code to work.
    Ian Anderson
    www.siteguru.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •