how can I disable and enable input type?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • idsanjeev
    New Member
    • Oct 2007
    • 241

    #16
    hi
    very fun today i am confuse how can solve it
    my code is very long there are 286 line if you have some time then i send you my full code i there is any problems or i don't use the code provided in properway so please all works i don't know javascript

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5390

      #17
      Originally posted by idsanjeev
      [CODE=html]
      <b>Purpose( In case of CD/FLOPPY )</b> &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;
      <input type="text" name="purpose" id="purpose" style="width:40 0px" maxlength="150" ></td></tr>
      [/CODE]
      [CODE=javascript]
      <script language="javas cript">
      function toggle_state(ob j) {
      // here we check the value of your select-box
      if var val = obj.value == 'cartridge';

      var input_node = document.getEle mentById('purpo se');

      input_node.styl e.visibility = val ? 'hidden' : 'visible';
      }

      </script>
      [/CODE]
      i chnges it like this is the incorrect if not then no magic
      have a look at the line 4 ... you added an if here ... that is useless, so simply remove it and it should work ...

      sending the code is not a good idea, may be you have a link to a testpage?

      kind regards

      Comment

      • idsanjeev
        New Member
        • Oct 2007
        • 241

        #18
        Hi Gits
        I know that
        but here is know file attachment option i am only online 1/2 hour tomorrow from morning 8 am ok
        one more page but i send you only first page where first work is done
        thanks

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5390

          #19
          hi ...

          in your code you have:

          [CODE=asp] <td Width="15%"><se lect Id="SEL_ITEM" Name="SEL_ITEM" Size="1">
          <option Selected Value>Select Item</option>
          <%
          Set RSITEM = CON.EXECUTE("SE LECT * FROM CONSUM_ITEMS ORDER BY Item_code")
          %>
          <%
          Do While Not RSITEM.EOF
          %> <option Value="<%=RSITE M("Item_code")% >" onchange="toggl e_state(this);" ><%=RSITEM("Ite m_desc")%></option>
          [/CODE]
          change in a way that the onchange is added to the select-element like:

          [CODE=asp]
          <select Id="SEL_ITEM" Name="SEL_ITEM" Size="1" onchange="toggl e_state(this);" >
          [/CODE]
          the onchange mustn't be added to the option-element

          kind regards

          Comment

          • idsanjeev
            New Member
            • Oct 2007
            • 241

            #20
            hi ...

            I Used your code but it not work when select option is selected automatic show input field and hide input field based on option

            Comment

            • gits
              Recognized Expert Moderator Expert
              • May 2007
              • 5390

              #21
              please explain in detail how the option will get automatically selected? ... in case you do it serverside you have to set the visibility of the input-box accordingly ...

              kind regards

              Comment

              • idsanjeev
                New Member
                • Oct 2007
                • 241

                #22
                hi gits
                i don't know about server side and client side
                the main things wants to do when user login then a page is open with option to select item, quantity and submit to create requision for item he can add more then one item in same requision to add one by one so when he selected cd and floppy then show the input field if option is cartidge then hide show i don't know which type of code have to write client side or server side.

                Comment

                • gits
                  Recognized Expert Moderator Expert
                  • May 2007
                  • 5390

                  #23
                  hi ...

                  please load your page to a browser and view the source-code -> copy that source-code from the browser, save it as a txt-file and post it here or send me a pm with it ... i have to have a closer look at it ...

                  kind regards

                  Comment

                  • idsanjeev
                    New Member
                    • Oct 2007
                    • 241

                    #24
                    Hi Gits
                    Thanks for kind supports i attached here both page where these work is need

                    Comment

                    • gits
                      Recognized Expert Moderator Expert
                      • May 2007
                      • 5390

                      #25
                      hi ...

                      you posted the asp-code ... but i wanted to have a look at the page when it is loaded to the browser :) ...

                      let me give you a working example here that uses the code:

                      [HTML]<html>
                      <script type="text/javascript">
                      function toggle_state(ob j) {
                      // here we check the value of your select-box
                      var val = obj.value == 'cartridge';

                      var input_node = document.getEle mentById('purpo se');

                      input_node.styl e.visibility = val ? 'hidden' : 'visible';
                      }
                      </script>
                      <body>
                      <select onchange="toggl e_state(this);" >
                      <option selected="selec ted" value="">select something</option>
                      <option value="cartridg e">cartridge </option>
                      <option value="CD">CD</option>
                      <option value="floppy"> floppy</option>
                      </select>
                      <input type="text" id="purpose" style="visibili ty:hidden;"/>
                      </body>
                      </html>
                      [/HTML]
                      have a look at it ... the onchange HAS to be added to the select and HASN'T to be added to the option (like in formsan1.txt) ... as far as i could see you preselect an option with no value ... so we could adapt the function then ... and have a look at the input-field ... i hide it initially ... now when you change the selected value we get the input shown in all cases except cartridge ...

                      kind regards

                      Comment

                      • idsanjeev
                        New Member
                        • Oct 2007
                        • 241

                        #26
                        hi gits
                        sorry i have only these two page and one another that is submit requistion and generate report for requestion some other pages thats is departmentwise reports i know that i used it when another page it work fine but in these pages it not work why i don't know so what i have to do
                        thanks

                        Comment

                        • idsanjeev
                          New Member
                          • Oct 2007
                          • 241

                          #27
                          Thanks Gits
                          You are the good guide i find it after long discussion with u
                          and i am very upsate becouse some confussion in the page that was not develped by me but i have to given this work for midification in the requestion system for restriction .
                          please if you have time then i know little about server side code and client side code by You. you are best gui.
                          thanks again

                          Comment

                          • gits
                            Recognized Expert Moderator Expert
                            • May 2007
                            • 5390

                            #28
                            no problem ... glad to hear you got it working :) ... if you have more questions concerning client- and serverside coding please post a new thread to the forum ...

                            kind regards

                            Comment

                            • idsanjeev
                              New Member
                              • Oct 2007
                              • 241

                              #29
                              Hi gits
                              you know whats is the problems where we are dusscused last time problems is select option is number and i am compairing it with character so this is the region of our long descussion realy i am mad.
                              sorry again problems in show and hide
                              problems is when first choosen by user is cartidge and any thing it work fine but addition for next item it not work.and when add button goes to error your case is cd and floppy so please enter purpose that message is report in case of cd and floppy after this message it work again
                              on the status bar it show error massage and double click on it show detail the error on line 25 object required char=5 code=0

                              Comment

                              • gits
                                Recognized Expert Moderator Expert
                                • May 2007
                                • 5390

                                #30
                                the add-action submits the form ... is the page reloaded then? ... now i think i would really need a link to a testpage for futher assistence ... i need to see the data-flow and interactions etc. for my own ...

                                kind regards

                                Comment

                                Working...