We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17010
    • 20 Posts
    I have a form that is using javascript to dynamically offer values via listbox. This form works under 1.4.4.5 but with 1.4.4.6, I get "Invalid value" whenever I attempt to submit the form (with each and every field filled out, including the listbox options).

    Now I just read in another post that something was changed in regards to listboxes so perhaps that introduced this.

    The js is probably too much to post here and I have reverted to 1.4.4.5 and am ok using that version, so I don’t really know why I am posting this, except maybe to give a heads up. I can supply the code if anyone wants to see it.
      • 30223
      • 1,010 Posts
      Yes please, submit the code, your snippet call and the form template so I can have a look at what could be the problem
        • 17010
        • 20 Posts
        After changing all the element tags to lowercase (http://modxcms.com/forums/index.php/topic,32983) I am also unable to submit the form using version 1.4.4.5. Which is good in that it is consistent, but bad for me in that I can’t use the form with (this) javascript. If you are still willing to look at my stuff, as requested I’ve attached the javascript and form and the Snippet call is:

        [!eForm? &formid=`eKinderfeestjesForm` &to=`[email protected],[email protected]` &tpl=`eKinderfeestjesForm` &report=`eKinderfeestReport` &thankyou=`eKinderfeestThanks` &mailselector=`restaurant` &vericode=`0` &subject=`Kinderfeest Aanvraag` &language=`Nederlands`!]

        Thanks
          • 30223
          • 1,010 Posts
          1. With what you’ve given me I can’t get any of the dynamic options to appear. I’m not quite sure why you are using eForm to be frank. You’re not using any kind of form validation (other than the automatic validation rules for radio inputs and select boxes - the latter one causing you the problem).

          2. The script you are using is looking rather old and I would be worried that it may not work with some of the newer browsers. If you go to Matt Kruse’s web site you’ll see it’ no longer anywhere on his site (At least I couldn’t find any reference to it).

          Edit: I retract this statement as I found his script on javascripttoolbox.com and it’s copyright statement mentions 2008. Not that old afterall smiley I haven’t evaluated his script so can make no claims about or against it.

          3. The reason you get the "invalid value" errors is because eform parses the form before it is send to the browser and for select boxes by default checks posted values against the list of values it found while parsing. This is a powerful feature of eForm but it is incompatible with javascript generated values. You can work around this by giving the select boxes a custom validation rule, which include possible values that are generated on the client side. Read the documentation in eform/docs/ and have a look through the wiki. It should give you some pointers.

            • 17010
            • 20 Posts
            I plan on adding form validation later, and am only in the beginning steps of the form. I figured I’d tackle this issue before complicating the form even more.

            You also need to add a <body onLoad="initDynamicOptionLists();"> to call the JS, perhaps that is why it is not working for you?

            I can’t get eForm to bypass the validation on the select boxes (well, actually it only complains about Feest, and if hth is selected then it also complains about Details.)

            I tried adding eform="::0::" and eform_options="::0::" (I couldn’t discern the difference except that the documentation also lists an example with eform_options). I also tried adding a #LIST with the valid options but it didn’t seem make any difference. Am I doing that right? For example I now have:
            <select name="Feest" size="2" id="Feest" eform="::0::" />

            The #LIST I tried was:
            eform="Feest soort:string:1:Kies een feest soort:#LIST SShappy,SSthema,SSfeest"

            I also searched through the forums (others must have had this issue too?) but didn’t find anything helpful.

            Sorry to be so incompetent on this.
              • 30223
              • 1,010 Posts
              You are on the right track... The 1 indicates that it is a required field. In your case the first two select boxes should probably be required but the last one (Details) should not be required as it may not contain any values

              This is what you should have for the 3 select tags:

              <select name="Restaurant" size="3" id="Restaurant" eform="::1::#LIST maarssen,hth">
              <select name="Feest" size="2" id="Feest" eform="::1::#LIST SShappy,SSfeest,SSthema">
              <select name="Details"  size="2" id="Details" eform="::0::#LIST princessje,piraat">
              


              I’ve tried out your form with this and these are the results (from debug output);
              ’formid’ passed using rule: #VALUE eKinderfeestjesForm, (input=eKinderfeestjesForm)
              ’Restaurant’ passed using rule: #LIST maarssen,hth (input=hth)
              ’Feest’ passed using rule: #LIST SShappy,SSfeest,SSthema (input=SSthema)
              ’Details’ passed using rule: #LIST princessje,piraat (input=piraat)
              ’dow’ passed using rule: #LIST Maandag,Dinsdag,Woensdag,Donderdag,Vrijdag,Zaterdag,Zondag (input=Dinsdag)
              ’geslacht’ passed using rule: #LIST jongen,meisje (input=meisje)
                • 17010
                • 20 Posts
                Yup, that did it (of course). Thank you for your help. It is quite frustrating when you are just plumb out of ideas.