Announcement

Collapse
No announcement yet.

Making a component mandatory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Making a component mandatory

    I have a workaround in place for options that do not affect the price, but really need to validate one of the components that affects the total price.

    I have split the components up within the product layout, and just wondered how I would find the id for each component in order to validate them?

    Hope that makes sense

    #2
    Originally posted by gordon7987 View Post
    Hope that makes sense
    Keep hoping i'm afraid, probably make more sense written in Swahili.

    Comment


      #3
      Originally posted by leehack View Post
      Keep hoping i'm afraid, probably make more sense written in Swahili.
      Fair enough

      The simplified version of my question is how do I make a drop down option mandatory using Javascript? I can not see how I can identify the component.

      Comment


        #4
        On the general tab of a component, don't tick the 'Is Optional' option. If it's not optional, it's mandatory.

        Comment


          #5
          Originally posted by leehack View Post
          On the general tab of a component, don't tick the 'Is Optional' option. If it's not optional, it's mandatory.
          Sorry Lee, I meant required, rather than mandatory. You know, a process which freezes the add to cart, and prompts the user to select something.

          I have created my own radio buttons, and added javascript form validation which works well, but I need to check another component has been selected in oder to activate another drop down. Just wondered is it possible to query the component id and use it within the javascript code.

          Comment


            #6
            Required and mandatory mean the same thing to me Gordon, so i am still a little confused to be honest. However if what you mean is that a certain combination must be selected before they can add to cart (ie add to cart is disabled until the condition is met), then you are looking at some custom outside work from someone as actinic will not do that as standard.

            A possible work around for you is to use permutations, offering a drop down list of choices, with a drop down box, even if they do not change the default setting, they will have to selected one option (the default one).

            Perhaps you could show us a URL instead of trying to explain as it will probably be easier if we can see what you are trying to do.

            Comment


              #7
              Originally posted by leehack View Post
              Required and mandatory mean the same thing to me Gordon, so i am still a little confused to be honest. However if what you mean is that a certain combination must be selected before they can add to cart (ie add to cart is disabled until the condition is met), then you are looking at some custom outside work from someone as actinic will not do that as standard.

              A possible work around for you is to use permutations, offering a drop down list of choices, with a drop down box, even if they do not change the default setting, they will have to selected one option (the default one).

              Perhaps you could show us a URL instead of trying to explain as it will probably be easier if we can see what you are trying to do.
              Spot on with what I need it to do Lee. And to be honest I cannot see a way of doing it! Just really wanted to make sure of that really. I have work rounds in place for the most important part of the process, in which I created html radio buttons and when the end user has selected something (checked by javascript), it populates a spare field so that the option can be seen in the cart.

              Many thanks

              Gordon

              Comment


                #8
                You could copy the product layout and in that copy add an onsubmit routine to the FORM tag that looks for Select tags and warns if selectedindex is 0.
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  Originally posted by NormanRouxel View Post
                  You could copy the product layout and in that copy add an onsubmit routine to the FORM tag that looks for Select tags and warns if selectedindex is 0.
                  I see what you mean Norman, I will have a go tonight.

                  Thanks for that.

                  Comment


                    #10
                    Something like (NB untested):

                    In your FORM tag:
                    Code:
                    onsubmit="return testdropdowns(this);"
                    and function testdropdowns is:
                    Code:
                    function testdropdowns(thisform){
                      var inputs=thisform.getElementsByTagName('input');
                      for (var i=0; i<inputs.length; i++)
                        {
                        if ( inputs[i].type == 'select-one' )
                          {
                          if ( inputs[i].selectedIndex == 0 )
                            {
                            alert('You must select something');
                            return false;
                            }
                          }
                        }
                      return true;
                    }
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment

                    Working...
                    X