could you help in creating checkboxes with condition.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajbala
    New Member
    • Oct 2006
    • 58

    could you help in creating checkboxes with condition.

    Hi all,

    I created two forms. In the first frame i had Items with checkbox like names of students etc. When ever i checked on any name It's display on the other frame. Up to know it's fine. But when i deselcted any check box it again display same name.
    My requirement is when i deselected the checkbox that particular student name is deleted from the list .
    Any one please give suggestion for above problem.
    your help will be appricited.
    TankQ.

    -Raju
  • vssp
    Contributor
    • Jul 2006
    • 268

    #2
    If u deselect the the check box uding check box value or id to delete the record.

    vssp

    Comment

    • rajbala
      New Member
      • Oct 2006
      • 58

      #3
      Originally posted by vssp
      If u deselect the the check box uding check box value or id to delete the record.

      vssp
      No it is not possible.
      you are not getting my problem.
      Iam using frames bcoz i want to dislay my result
      in another frame.; Iam retriving a variable from database and
      displaying that variable in another frame.
      Therfore It's compulsary to display the name in
      the another frame.
      -raju

      Comment

      • vee10
        New Member
        • Oct 2006
        • 141

        #4
        hi
        is that in other frame u r displaying that value in any textbox or textarea

        Originally posted by rajbala
        No it is not possible.
        you are not getting my problem.
        Iam using frames bcoz i want to dislay my result
        in another frame.; Iam retriving a variable from database and
        displaying that variable in another frame.
        Therfore It's compulsary to display the name in
        the another frame.
        -raju

        Comment

        • rajbala
          New Member
          • Oct 2006
          • 58

          #5
          Originally posted by vee10
          hi
          is that in other frame u r displaying that value in any textbox or textarea
          yes,

          It is other frame.

          Comment

          • AricC
            Recognized Expert Top Contributor
            • Oct 2006
            • 1885

            #6
            Maybe this link will help:

            Comment

            • rajbala
              New Member
              • Oct 2006
              • 58

              #7
              Originally posted by AricC
              Hi,
              Thankyou for above link. But in that link i couldnot found to working on checkbox between frames. It doesn't help me anything.ok
              I want to tell you up to know what i had be done and what i want.

              I created two forms. In the first frame i had Items with checkbox like names of students etc. When ever i checked on any name It's display on the other frame. Up to know it's fine. But when i deselcted any check box it again display same name.
              My requirement is when i deselected the checkbox that particular student name is deleted from the list .
              Any one please give suggestion for above problem.

              TankQ.

              -Raju

              Comment

              • vee10
                New Member
                • Oct 2006
                • 141

                #8
                hi,

                I think this code solves ur problem i have taken three checkboxes and in other frame i displayed it in a textarea

                Code:
                 
                [b]This is parent frame[/b]
                 
                <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
                 
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                 
                <html>
                <head>
                <script language="JavaScript" type="text/javascript">
                var index=0;
                function passText(str,str1) {
                 
                if(str1==true)
                {
                if(top.frames['right'].document.yourform.text.value=="")
                top.frames['right'].document.yourform.text.value=str;
                else
                top.frames['right'].document.yourform.text.value=top.frames['right'].document.yourform.text.value+"\n"+str;
                }
                else 
                {
                var string=top.frames['right'].document.yourform.text.value;
                if(string.indexOf(str)!=-1)
                { 
                index=string.indexOf(str);
                if(string.length==str.length)
                top.frames['right'].document.yourform.text.value="";
                else
                {
                index=0;index1=0,count=0,flag=0;
                index=string.indexOf(str);
                var temp="";
                while(index1<string.length)
                {
                if(index1==index)
                {
                flag=1;
                if(index!=0)
                {
                temp=string.substring(0,count);
                count=0;
                }
                }
                else
                {
                 
                ++count;
                 
                if(count==str.length&& index1<string.length&&flag==1)
                {
                temp=temp+string.substring(index1+2,string.length);
                break;
                }
                }
                index1++;
                }
                top.frames['right'].document.yourform.text.value=temp;
                }
                }
                }
                }
                function Textbox()
                {
                //<input type="text" name="text1" />
                }
                // End -->
                </script>
                </head>
                <frameset cols="300,*" frameborder=1>
                <frame name="left" src="Default2.aspx">
                <frame name="right" src="Default3.aspx">
                </frameset> 
                </html>
                 
                [b]checkbox frame[/b]
                 
                <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
                 
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                 
                <html>
                <body>
                <center>
                <form name=myform>
                Enter Your Name:<br>
                <%--<input type=text name=user size=10 value="">
                <input type=button value="Ok!" onClick="parent.passText(this.form.user.value);">--%>
                <input type="checkbox" name="name" value="name1" onclick="parent.passText(this.form.name.value,document.myform.name.checked);" />Name1
                <input type="checkbox" name="name1" value="name2" onclick="parent.passText(this.form.name1.value,document.myform.name1.checked);"/>Name2
                <input type="checkbox" name="name2" value="name3" onclick="parent.passText(this.form.name2.value,document.myform.name2.checked);"/>Name2 
                 
                </form>
                </center>
                </body>
                </html>
                 
                displaying the values frame
                 
                <html>
                <body>
                <form name="yourform">
                <textarea name="text" rows="5" cols="10">
                </textarea>
                </form>
                </body>
                </html>
                i hope this solves and if any problem just give what the problem u get

                Originally posted by rajbala
                Hi,
                Thankyou for above link. But in that link i couldnot found to working on checkbox between frames. It doesn't help me anything.ok
                I want to tell you up to know what i had be done and what i want.

                I created two forms. In the first frame i had Items with checkbox like names of students etc. When ever i checked on any name It's display on the other frame. Up to know it's fine. But when i deselcted any check box it again display same name.
                My requirement is when i deselected the checkbox that particular student name is deleted from the list .
                Any one please give suggestion for above problem.

                TankQ.

                -Raju
                Last edited by Niheel; Nov 11 '06, 09:09 AM.

                Comment

                • rajbala
                  New Member
                  • Oct 2006
                  • 58

                  #9
                  hi,
                  I gone through this code. I think it's in vb,any how I change in javascript. While i click on button yes it displaying.but while i deselect it doesn't do any function...
                  I want when i click on that text area or frame I want again to select that option. I don't want only displaying on text area. I need to select again that selcted items.

                  tankQ.
                  -raju.










                  Originally posted by vee10
                  hi,

                  I think this code solves ur problem i have taken three checkboxes and in other frame i displayed it in a textarea

                  Code:
                  [B]This is parent frame[/B]
                  
                  <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
                  
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  
                   <html>
                  <head>
                  <script language="JavaScript" type="text/javascript">
                  var index=0;
                  function passText(str,str1) {
                  
                  if(str1==true)
                  {
                  if(top.frames['right'].document.yourform.text.value=="")
                  top.frames['right'].document.yourform.text.value=str;
                  else
                  top.frames['right'].document.yourform.text.value=top.frames['right'].document.yourform.text.value+"\n"+str;
                  }
                  else 
                  {
                  var string=top.frames['right'].document.yourform.text.value;
                  if(string.indexOf(str)!=-1)
                  { 
                  index=string.indexOf(str);
                  if(string.length==str.length)
                  top.frames['right'].document.yourform.text.value="";
                  else
                  {
                  index=0;index1=0,count=0,flag=0;
                  index=string.indexOf(str);
                  var temp="";
                  while(index1<string.length)
                  {
                  if(index1==index)
                  {
                  flag=1;
                  if(index!=0)
                  {
                  temp=string.substring(0,count);
                  count=0;
                  }
                  }
                  else
                  {
                  
                  ++count;
                   
                  if(count==str.length&& index1<string.length&&flag==1)
                  {
                  temp=temp+string.substring(index1+2,string.length);
                  break;
                  }
                  }
                  index1++;
                  }
                  top.frames['right'].document.yourform.text.value=temp;
                  }
                  }
                  }
                  }
                  function Textbox()
                  {
                  //<input type="text" name="text1" />
                  }
                  // End -->
                  </script>
                  </head>
                  <frameset cols="300,*" frameborder=1>
                  <frame name="left" src="Default2.aspx">
                  <frame name="right" src="Default3.aspx">
                  </frameset> 
                  </html>
                  
                  [B]checkbox frame[/B]
                  
                  <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
                  
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  
                   <html>
                  <body>
                  <center>
                  <form name=myform>
                  Enter Your Name:<br>
                  <%--<input type=text name=user size=10 value="">
                  <input type=button value="Ok!" onClick="parent.passText(this.form.user.value);">--%>
                  <input type="checkbox" name="name" value="name1" onclick="parent.passText(this.form.name.value,document.myform.name.checked);" />Name1
                  <input type="checkbox" name="name1" value="name2" onclick="parent.passText(this.form.name1.value,document.myform.name1.checked);"/>Name2
                  <input type="checkbox" name="name2" value="name3" onclick="parent.passText(this.form.name2.value,document.myform.name2.checked);"/>Name2     
                  
                  </form>
                  </center>
                  </body>
                  </html>
                  
                  displaying the values frame
                  
                   <html>
                  <body>
                  <form name="yourform">
                  <textarea name="text" rows="5" cols="10">
                  </textarea>
                  </form>
                  </body>
                  </html>
                  i hope this solves and if any problem just give what the problem u get
                  E=rajbala]Hi,
                  Thankyou for above link. But in that link i couldnot found to working on checkbox between frames. It doesn't help me anything.ok
                  I want to tell you up to know what i had be done and what i want.

                  I created two forms. In the first frame i had Items with checkbox like names of students etc. When ever i checked on any name It's display on the other frame. Up to know it's fine. But when i deselcted any check box it again display same name.
                  My requirement is when i deselected the checkbox that particular student name is deleted from the list .
                  Any one please give suggestion for above problem.

                  TankQ.

                  -Raju
                  [/QUOTE]

                  Comment

                  • vee10
                    New Member
                    • Oct 2006
                    • 141

                    #10
                    hi,

                    i did the code in .net frame work so the code behind language is vb the script
                    is the javascript ok

                    the below code may solve ur problem

                    Code:
                    Parent frame:
                    
                    
                    
                    
                    
                     <html>
                    <head>
                    <script language="JavaScript" type="text/javascript">
                    var index=0;
                    function passText(str,str1) 
                    {
                    if(str1==true)
                    {
                    if(top.frames['right'].document.yourform.text.value=="")
                    top.frames['right'].document.yourform.text.value=str;
                    else
                    top.frames['right'].document.yourform.text.value=top.frames['right'].document.yourform.text.value+"\n"+str;
                    }
                    }
                    function selectText()
                    {
                    str=top.frames['right'].document.yourform.text.value;
                      if(top.frames['left'].document.myform.name1.checked==false)
                     {
                     if(str.indexOf(top.frames['left'].document.myform.name1.value)!=-1)
                     top.frames['left'].document.myform.name1.checked=true;
                     }
                    if(top.frames['left'].document.myform.name2.checked==false)
                     {
                     if(str.indexOf(top.frames['left'].document.myform.name2.value)!=-1)
                     top.frames['left'].document.myform.name2.checked=true;
                     }
                    if(top.frames['left'].document.myform.name3.checked==false)
                     {
                     if(str.indexOf(top.frames['left'].document.myform.name3.value)!=-1)
                     top.frames['left'].document.myform.name3.checked=true;
                     }
                    
                    }
                    
                    // End -->
                    </script>
                    </head>
                    <frameset cols="300,*" frameborder=1>
                    <frame name="left" src="Default2.aspx">
                    <frame name="right" src="Default3.aspx">
                    </frameset> 
                    </html>
                    
                    
                    left frame
                    
                    
                     <html>
                    <body>
                    <center>
                    <form name=myform>
                    Enter Your Name:<br>
                    <%--<input type=text name=user size=10 value="">
                    <input type=button value="Ok!" onClick="parent.passText(this.form.user.value);">--%>
                    <input type="checkbox" name="name1" value="name1" onclick="parent.passText(this.form.name1.value,document.myform.name1.checked);" />Name1
                    <input type="checkbox" name="name2" value="name2" onclick="parent.passText(this.form.name2.value,document.myform.name2.checked);"/>Name2
                    <input type="checkbox" name="name3" value="name3" onclick="parent.passText(this.form.name3.value,document.myform.name3.checked);"/>Name3     
                    
                    </form>
                    </center>
                    </body>
                    </html>
                    
                    [right frame]
                    
                    
                     <html>
                    <body>
                    <form name="yourform">
                    <textarea name="text" rows="5" cols="10"
                     onclick="parent.selectText();"></textarea>
                    </form>
                    </body>
                    </html>













                    Originally posted by rajbala
                    hi,
                    I gone through this code. I think it's in vb,any how I change in javascript. While i click on button yes it displaying.but while i deselect it doesn't do any function...
                    I want when i click on that text area or frame I want again to select that option. I don't want only displaying on text area. I need to select again that selcted items.

                    tankQ.
                    -raju.









                    [/QUOTE]

                    Comment

                    • rajbala
                      New Member
                      • Oct 2006
                      • 58

                      #11
                      Originally posted by vee10
                      hi,

                      i did the code in .net frame work so the code behind language is vb the script
                      is the javascript ok

                      the below code may solve ur problem

                      Code:
                      Parent frame:
                      
                      
                      
                      
                      
                       <html>
                      <head>
                      <script language="JavaScript" type="text/javascript">
                      var index=0;
                      function passText(str,str1) 
                      {
                      if(str1==true)
                      {
                      if(top.frames['right'].document.yourform.text.value=="")
                      top.frames['right'].document.yourform.text.value=str;
                      else
                      top.frames['right'].document.yourform.text.value=top.frames['right'].document.yourform.text.value+"\n"+str;
                      }
                      }
                      function selectText()
                      {
                      str=top.frames['right'].document.yourform.text.value;
                        if(top.frames['left'].document.myform.name1.checked==false)
                       {
                       if(str.indexOf(top.frames['left'].document.myform.name1.value)!=-1)
                       top.frames['left'].document.myform.name1.checked=true;
                       }
                      if(top.frames['left'].document.myform.name2.checked==false)
                       {
                       if(str.indexOf(top.frames['left'].document.myform.name2.value)!=-1)
                       top.frames['left'].document.myform.name2.checked=true;
                       }
                      if(top.frames['left'].document.myform.name3.checked==false)
                       {
                       if(str.indexOf(top.frames['left'].document.myform.name3.value)!=-1)
                       top.frames['left'].document.myform.name3.checked=true;
                       }
                      
                      }
                      
                      // End -->
                      </script>
                      </head>
                      <frameset cols="300,*" frameborder=1>
                      <frame name="left" src="Default2.aspx">
                      <frame name="right" src="Default3.aspx">
                      </frameset> 
                      </html>
                      
                      
                      left frame
                      
                      
                       <html>
                      <body>
                      <center>
                      <form name=myform>
                      Enter Your Name:<br>
                      <%--<input type=text name=user size=10 value="">
                      <input type=button value="Ok!" onClick="parent.passText(this.form.user.value);">--%>
                      <input type="checkbox" name="name1" value="name1" onclick="parent.passText(this.form.name1.value,document.myform.name1.checked);" />Name1
                      <input type="checkbox" name="name2" value="name2" onclick="parent.passText(this.form.name2.value,document.myform.name2.checked);"/>Name2
                      <input type="checkbox" name="name3" value="name3" onclick="parent.passText(this.form.name3.value,document.myform.name3.checked);"/>Name3     
                      
                      </form>
                      </center>
                      </body>
                      </html>
                      
                      [right frame]
                      
                      
                       <html>
                      <body>
                      <form name="yourform">
                      <textarea name="text" rows="5" cols="10"
                       onclick="parent.selectText();"></textarea>
                      </form>
                      </body>
                      </html>












                      [/QUOTE]





                      Hi,
                      Thanks for this.I got this correctly but i need some more in this.
                      i.e if i checked the checkbox the string is added to textarea.Simila rly if remove the checking then string must deleted from textarea.Rely me as soon as Possible.

                      Comment

                      • vee10
                        New Member
                        • Oct 2006
                        • 141

                        #12
                        hi,

                        the before one not this one which i have posted is giving that fuctionality

                        only

                        is that both functionalities are to be added then can u once explain me what u want














                        Hi,
                        Thanks for this.I got this correctly but i need some more in this.
                        i.e if i checked the checkbox the string is added to textarea.Simila rly if remove the checking then string must deleted from textarea.Rely me as soon as Possible.[/QUOTE]

                        Comment

                        • rajbala
                          New Member
                          • Oct 2006
                          • 58

                          #13
                          hi,
                          At first A big thank's for you.
                          vb is not working in my system. That one also not clear.

                          ok i explain once again.

                          When i make checked on check box the particular name will be dispalyed and when deselect the check box that particular name must be deleted from the text area not from database in mean from the list of text area present in your code. And more over i want again select names from selected names(i.e as per your code when i click on text area names are again select and placed in another frame or anything.)

                          By second code is out put is when click on names it is displaying but when i deselect the check box it doen't removing the name if in case i again check it displaying names. as per your code number of copy of names are displaying and when we deselect it doen't delete and moreover it doesn't provide to again select from text area.
                          TankQ

                          -Raju

                          Originally posted by vee10
                          hi,

                          the before one not this one which i have posted is giving that fuctionality

                          only

                          is that both functionalities are to be added then can u once explain me what u want
















                          Hi,
                          Thanks for this.I got this correctly but i need some more in this.
                          i.e if i checked the checkbox the string is added to textarea.Simila rly if remove the checking then string must deleted from textarea.Rely me as soon as Possible.
                          [/QUOTE]

                          Comment

                          • vee10
                            New Member
                            • Oct 2006
                            • 141

                            #14
                            hi,

                            I rectified that problem i have not checked it ok just in this code see whether after deselecting and again selecting whether copies of names are generated and can u tell me whether after deselecting the checkbox whether that name should be deleted and what do u mean by

                            "i want again select names from selected names"

                            i am not clear about this i feel sorry that i am asking u to explain this many times then i can change code accordingly
                            don't think about this vb
                            just paste it and run it that's all

                            Code:
                            parent
                            
                             <html>
                            <head>
                            <script language="JavaScript" type="text/javascript">
                            var index=0;
                            function passText(str,str1) 
                            {
                            if(str1==true)
                            {
                            if(top.frames['right'].document.yourform.text.value=="")
                            top.frames['right'].document.yourform.text.value=str;
                            else
                            {
                             
                            var str1=top.frames['right'].document.yourform.text.value;
                             if(str1.indexOf(str)==-1)
                            top.frames['right'].document.yourform.text.value=top.frames['right'].document.yourform.text.value+"\n"+str;
                            }
                            
                            }
                            
                            }
                            function selectText()
                            {
                            str=top.frames['right'].document.yourform.text.value;
                              if(top.frames['left'].document.myform.name1.checked==false)
                             {
                             if(str.indexOf(top.frames['left'].document.myform.name1.value)!=-1)
                             top.frames['left'].document.myform.name1.checked=true;
                             }
                            if(top.frames['left'].document.myform.name2.checked==false)
                             {
                             if(str.indexOf(top.frames['left'].document.myform.name2.value)!=-1)
                             top.frames['left'].document.myform.name2.checked=true;
                             }
                            if(top.frames['left'].document.myform.name3.checked==false)
                             {
                             if(str.indexOf(top.frames['left'].document.myform.name3.value)!=-1)
                             top.frames['left'].document.myform.name3.checked=true;
                             }
                            
                            }
                            
                            </script>
                            </head>
                            <frameset cols="300,*" frameborder=1>
                            <frame name="left" src="Default2.aspx">
                            <frame name="right" src="Default3.aspx">
                            </frameset> 
                            </html>
                            
                            [child frame]
                            
                             <html>
                            <body>
                            <center>
                            <form name=myform>
                            Enter Your Name:<br>
                            <%--<input type=text name=user size=10 value="">
                            <input type=button value="Ok!" onClick="parent.passText(this.form.user.value);">--%>
                            <input type="checkbox" name="name1" value="name1" onclick="parent.passText(this.form.name1.value,document.myform.name1.checked);" />Name1
                            <input type="checkbox" name="name2" value="name2" onclick="parent.passText(this.form.name2.value,document.myform.name2.checked);"/>Name2
                            <input type="checkbox" name="name3" value="name3" onclick="parent.passText(this.form.name3.value,document.myform.name3.checked);"/>Name3     
                            
                            </form>
                            </center>
                            </body>
                            </html>
                            [right]
                            
                            
                            
                             <html>
                            <body>
                            <form name="yourform">
                            <textarea name="text" rows="5" cols="10" onclick="parent.selectText();"></textarea>
                            
                            </form>
                            </body>
                            </html>




















                            Originally posted by rajbala
                            hi,
                            At first A big thank's for you.
                            vb is not working in my system. That one also not clear.

                            ok i explain once again.

                            When i make checked on check box the particular name will be dispalyed and when deselect the check box that particular name must be deleted from the text area not from database in mean from the list of text area present in your code. And more over i want again select names from selected names(i.e as per your code when i click on text area names are again select and placed in another frame or anything.)

                            By second code is out put is when click on names it is displaying but when i deselect the check box it doen't removing the name if in case i again check it displaying names. as per your code number of copy of names are displaying and when we deselect it doen't delete and moreover it doesn't provide to again select from text area.
                            TankQ

                            -Raju
                            [/QUOTE]

                            Comment

                            • rajbala
                              New Member
                              • Oct 2006
                              • 58

                              #15
                              hi,
                              tahkyou for reply.

                              The you given is not deleted the element or check box when we deselected the checkbox.

                              I explain you with a example. \
                              Step 1:If i had the follwing words

                              -A
                              -B
                              -C
                              -D
                              -E
                              -F
                              -G........

                              step 2: I select A,B,C,D from above list by making a ckeck on them.
                              step 3: Ok Again i want to select B,C from list A,B,C,D (i.e from step 2).

                              they are selected from different frames.

                              -Raju

                              Comment

                              Working...