The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
|
javascript dynamic field type unknown - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: Installation (https://forums.formtools.org/forumdisplay.php?fid=4) +--- Thread: javascript dynamic field type unknown (/showthread.php?tid=673) |
javascript dynamic field type unknown - Rocket Music - Apr 26th, 2010 newbie here. I'm using javascript to dynamically generate price options for custom item (guitar) configurator. FT finds the fields ok, but will not recognize the field types for any form entries in the javascript. Example: document.write("<input name=\"otheroptions\" type=\"radio\" value=\"" + decallogo + "\" checked onClick=\"checkData()\"> Decal logo <br/>"); I got this form working fine without the javascript document.write(" stuff, so I'm confident everything else is in order. And I can't seem to manually add the field options and get them to work. Here's the form, in case it helps: http://www.rocketmusiconline.com/SuhrStandard/SuhrSCT.php Is there any way I can get it to find the field options?? I'm so close !! Thanks for ANY help. Dan Rocket Music RE: javascript dynamic field type unknown - Ben - Apr 26th, 2010 Hi Dan, Ah... so the problem is with the Add Form process itself? No, I don't think that will be able to populate the option values since they're dynamically generated. One option would be to just forge ahead and finish the form. You can then manually add the form fields later. But this can be a real pain if there are dozens or hundreds of radio / checkbox / dropdown field options. A second option is a little sneakier... I've had to resort to this in a couple of situations. Quick explanation first. Step 5 of the Add Form process actually loads your form page(s) into hidden iframes in the page, then uses javascript to parse the form fields. However, sometimes JS loading in the iframe fails to work properly so the Add Form process isn't able to read the values. So! Instead of actually getting the script to parse the dynamically generated page, you can fool it and show. Load up your webpage in a browser (preferably Firefox because it's easiest). Then, view DYNAMIC source on the page. This shows all current markup, including that that's been generated via JS. Firefox has an option for this on the right-click menu. IE... who knows. Then, save that file in the same folder as your form. Then, in the Add Form process, return to step 1 and enter the URL of this scraped page. That should enable the Add Form script to do it's job and locate the fields. Hope this helps! - Ben RE: javascript dynamic field type unknown - Rocket Music - Apr 26th, 2010 Ben, Thanks for the help !!! Yes, in the Add Form process (I assumed that was part of the install, but maybe I posted to the wrong topic). ok. I can understand why the JS used to parse the fields might choke with JS used in the forms, and my code is probably sloppy :-) I did manually add the form fields, but I couldn't get the options to show up when I submitted data - that worries me that the radio buttons are not working with FT. Radio buttons are a pain !! But I'm this far, so I'm committed. I'll try the scraping method. Like I said, I stripped out the javascript, and the Add Form process worked fine, though I never submitted data to check. Maybe I should. I assumed it would be ok. I also tried to upload a version of the form devoid of JS - trying to trick it into filling in the field options from the raw form. Is it worth trying to do that now that I know I have a version of the form that works?? This gives me some things to try. Again, THANKS !!! RE: javascript dynamic field type unknown - Rocket Music - Apr 27th, 2010 Ben, I think that worked !!! I had to install the Web Developers toolbar plugin for Firefox to get the rendered source, but it works (so far). Getting closer. THANKS !!! Dan Rocket Music RE: javascript dynamic field type unknown - Ben - May 1st, 2010 Brilliant, very glad to hear. - Ben |