1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help With Fixing a Javascript Form

Discussion in 'HTML & Website Design' started by Jack Mattison, May 6, 2020.

  1. #1
    Hi guys

    I have inherited a website for a client that features a custom-coded JavaScript form which customers use to make a family mediation referral. The user submits the form and then a ColdFusion script hosted on a Lucee server is called that generates a PDF and then emails this to the client, using MailGun. Nothing has been actively changed however the form has stopped working in the sense that a successful submission message is returned to the user however no PDF is generated.



    The previous developer has provided the following advice as to how I can identify the error, however could someone clarify how I execute the first step he has suggested (creating a test URL string using PAW) as this isn't something I've done before and want to make sure that I'm doing it correctly so I can rely on the output of PAW to be accurate.



    His advice is as follows:



    "Assuming nothing has been done to the Lucee server that generates the PDFs, I would start by tracing back to identify where the problem lies. I would manually create a test URL string that submits the form on referral.wyfms.co.uk and see what the output is, using the JS that’s in the HTML form submission code. You could use something like Paw to assist you with this if its something you’re not familiar with (https://paw.cloud).
    SEMrush


    That would be the first port of call as its injecting the homepage HTML into the ‘done’ message via Ajax upon the form submission, suggesting there’s an issue with the output of the form, and rather than showing an error its defaulting to forwarding to the homepage.



    Given that the Lucee server has never fallen over before when there’s been no changes to it or the code its executing I suspect its something simple but I would try manual form submission first to try to pin down any error messages first. This would also ensure that no DNS or IIS changes have been made that make the Lucee server on referral.wyfms.co.uk not to function. Ideally you want to trigger a Lucee error to see that its active. These are a distinct mustard colour.



    Another useful tool is Charles that acts as a web proxy to see what’s going on with Ajax scripts that are being executed and can decrypt SSL when configured correctly (https://www.charlesproxy.com), but try the above first."



    Any help would be much appreciated.



    Thanks

    Jack
     
    Jack Mattison, May 6, 2020 IP
    SEMrush
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,340
    Likes Received:
    1,830
    Best Answers:
    244
    Trophy Points:
    515
    #2
    Coldfusion?!? What is this 2003?

    Seriously, this sounds like a real charlie-foxtrot of taking something simple -- a form that sends and e-mail -- and ridiculously overthinking it. If it's 100% reliant on client-side scripting it's likely broken on the accessibility front, a WCAG violation that being medical related could in fact be in violation of the law. Wasting time making a PDF out of what could likely just as easily -- if not more easily -- be built as HTML client side seems equally flawed.

    As an accessibility consultant, just the title "JavaScript form" throws up massive warning flags; particularly where "family mediation" sounds like some sort of psychotherapy or other medical/family service. The type of services that what you describe makes it shocking they've not been sued. I might be wrong on that, I'd need to see the page and better understand what it is for to say for certain.

    Depending on the complexity of this form and system, it may be faster to simply chuck all that bloat, overhead, and reliance on extra outdated nonsense like Lucee JVM trash, browser wars era ColdFusion relic, possible "AJAX for nothing" or worse, AJAX used in a manner that violates accessibility minimums, etc, etc, etc... and simply replace it all with a normal every-day form and form handler, sending the result as an HTML attachment instead of PDF.

    It would really depend on the form and the output, but in general that's not even two hours labor to recreate from scratch in a manner that would run faster, smoother, and with far less fragility than the train wreck stack of nonsense that seems to be in place. It really sounds like whoever made this mess either wasn't qualified to work with web technologies, or just blindly slapped together a bunch of off the shelf answers due to being pressed for time.

    Particularly when the technologies you've rattled off haven't been relevant in modern development for over a decade. I mean really, CFML? Good gravy. No wonder it broke. Lemme guess, it's still spitting out HTML 3.2 with presentational markup, isn't it?
     
    deathshadow, May 6, 2020 IP
    kk5st likes this.
  3. LewisH95

    LewisH95 Greenhorn

    Messages:
    102
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    23
    #3
    Use a framework!
    Make the XMLHTTPRequest request yourself, passing post into the open method instead of getting.
    Via JavaScript, dynamically create a form, add an action, add your inputs, and submit that.
     
    LewisH95, May 8, 2020 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,340
    Likes Received:
    1,830
    Best Answers:
    244
    Trophy Points:
    515
    #4
    So your advice is to go full Gungan making it even worse with even more convoluted unnecessary inaccessible crap?!?

    [​IMG]
     
    deathshadow, May 8, 2020 IP