Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-23-2008, 05:21 AM
WebProWorld New Member
 

Join Date: Nov 2007
Posts: 12
kumiko RepRank 0
Default put checked radio ID separated by a delimiter into hidden field

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
    <title>Untitled Page</title>
    
</head>
<script language ="javascript">
function chkRadio()
{
   
    column =document.list_photo.hidCounter.value;
    var total = 0;
    var file =0;
    
    for(var i=1; i<=column; i++)
    {
        var objId = "chkBuy" + i;
        var obj = eval("document.list_photo." + objId);
        document.list_photo.totalcredit.value = obj.length;
      for(var j=0; j<obj.length; j++)
      {
        if(obj[j].checked && obj[j].value != 0)
        {
        total += eval(obj[j].value);
        file++;
        }
      }
    }
    document.list_photo.total_file.value =file;
    document.getElementById('totalfile').innerHTML =file;
    document.getElementById('creditcost').innerHTML =total;
}
    
function chkPhoto(photoid)
{
        delim ='.';
        v =photoid;
        v=v+delim;
     var oldv=document.getElementById('photo').value;
     document.getElementById('photo').value=oldv+v;
}

function chkValue()
{
    column =document.list_photo.hidCounter.value;
    var checked =false;
    if(document.list_photo.chkAgree.checked ==false)
    {
        alert("Please agree To terms");
        return false;
    }
    
    if(document.list_photo.total_file.value =="")
    {
            alert("Please select the images you wish to download.");
            return false;
    }
        document.list_photo.hidSubmit.value ="Submit";
        boxid =document.list_photo.hidboxid.value;
        document.list_photo.action ="lightbox_download.asp?boxid="+ boxid ;
        document.list_photo.submit();
}
 
</script>
<body>
<a href="list_lightbox.asp">List lightbox</a><br /><br />
<form name="list_photo" id="f1" method="post">
<table border="1">

    <tr>
        <td valign="top">IMAGE DISPLAY HERE</td>
        <td  valign="top"><a href ="view_photo.asp?photoid=1">dog</a><BR /> alice</td>
        <td>
            
            <table>
            
                <tr>
                <td>XSmall&nbsp; - 100 x 100 px @ 72 Dpi  </td>
                <td>- 1Credit</td>
                <td><input type="Radio" name="chkBuy1" value="1" onClick="chkRadio();chkPhoto('1');" /></td>
                </tr>
            
                <tr>
                <td>Small&nbsp; - 200 x 280 px @ 72 Dpi  </td>
                <td>- 3Credits</td>
                <td><input type="Radio" name="chkBuy1" value="3" onClick="chkRadio();chkPhoto('1');" /></td>
                </tr>
            
                <tr>
                <td>Medium&nbsp; - 500 x 600 px @ 300 Dpi  </td>
                <td>- 5Credits</td>
                <td><input type="Radio" name="chkBuy1" value="5" onClick="chkRadio();chkPhoto('1');" /></td>
                </tr>
            
                <tr>
                    <td colspan="2" align="right">Skip This image file</td>
                    <td>
                    <input type="Radio" name="chkBuy1" value="0" onClick="chkRadio(this.value,'1')"  checked />
                    <input type="text" name="hiddX" value="1" size="5"/>
                    <input type="hidden" name="totalrecord1" value="" size="5"/>
                    </td>
                </tr>
            
            </table>
          </td>
    </tr>
    <tr>
        <td valign="top">IMAGE DISPLAY HERE</td>
        <td  valign="top"><a href ="view_photo.asp?photoid=3">cat</a><BR /> lenny</td>
        <td>
            
            <table>
            
                <tr>
                <td>Small&nbsp; - 200 x 250 px @ 72 Dpi  </td>
                <td>- 3Credits</td>
                <td><input type="Radio" name="chkBuy2" value="3" onClick="chkRadio();chkPhoto('3');" /></td>
                </tr>
            
                <tr>
                <td>XSmall&nbsp; - 250 x 250 px @ 72 Dpi  </td>
                <td>- 1Credit</td>
                <td><input type="Radio" name="chkBuy2" value="1" onClick="chkRadio();chkPhoto('3');" /></td>
                </tr>
            
                <tr>
                    <td colspan="2" align="right">Skip This image file</td>
                    <td>
                    <input type="Radio" name="chkBuy2" value="0" onClick="chkRadio(this.value,'2')"  checked />
                    <input type="text" name="hiddX" value="2" size="5"/>
                    <input type="hidden" name="totalrecord2" value="" size="5"/>
                    </td>
                </tr>
            
            </table>
          </td>
    </tr>
 
    <tr>
        <td colspan="3">
        <input type="text" name="photo" id="inputs"  />
     
        
        </td>
    </tr>
    
 </table>
</form>
</body>
</html>
hi there..i need some help. above is my HTML code from my view source page. i got a list of dynamic radio button wif the radio button name is differnt . in the radio button, when onclick i call two function. for the 2nd fucntion, i need to pass 1 kind of value that is photoid (not the radio button own value) to the function. chkPhoto('3');" . wat i need to do is, when onclick any radio button, it will directly assign the PARAMETER photo id into the text box (hidden field) with the delimeter '.'(dot). but wat i have did is...this will add continous when i click on the radio button. let said, from the code. i have photo id 1,3. first time, i click the radio button, it will asssing the value into the text box. but after that, i click the radio button again, it add the valeu again. wat i wan is it jz will display 1.3 not everytime i click the radio button, it will be like this 1.1.3.3.1.1.3. soli for the poor explaination. hope u all understand..plz help..urgent..thank you.. hope u all can help me check this code..thank you very much
Reply With Quote
  #2 (permalink)  
Old 01-23-2008, 05:28 AM
WebProWorld New Member
 

Join Date: Nov 2007
Posts: 12
kumiko RepRank 0
Default Re: put checked radio ID separated by a delimiter into hidden field

halo there..plz help me based on my code...plz help..thank you
Reply With Quote
  #3 (permalink)  
Old 01-24-2008, 10:45 AM
WebProWorld New Member
 

Join Date: Nov 2007
Posts: 12
kumiko RepRank 0
Default Re: put checked radio ID separated by a delimiter into hidden field

problem solved.thank you
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Google Buys Radio Ad Firm; AdWords Headed To Radio Distribu WPW_Feedbot Search Engine Optimization Forum 0 01-17-2006 10:30 AM
Google and the automated spell checked query dilipsam Google Discussion Forum 1 01-13-2005 01:00 PM
where field in() problem redstarfcs Database Discussion Forum 1 10-21-2004 02:46 AM
I think I checked all off my list... mknight0 Search Engine Optimization Forum 5 09-18-2004 06:52 AM
Separated at Birth? steve0 Breakroom (General: Any Topic) 3 07-22-2004 02:47 PM


Search Engine Optimization by vBSEO 3.2.0