• 0

Form not submitted when click() method is used in Firefox.


Question

Hi!
 
I need to make an old made for IE only web app compatible with Chrome and Firefox. 90% of the job is done but i still have a small problem.
 
So i have a form like this.
 

<form id="formCarte" name="formCarte" method="post" action="{url}" enctype="application/x-www-form-urlencoded">    
  {inputs}
  <input id="formCarte:cmdCarte" name="formCarte:cmdCarte" type="submit" onclick="{someCode}" class="zoneCarteBoutonx" />
</form>

The code inside the onclick is generated by a framework (Apache MyFaces i think) so i have no control over this and it needs to be executed. The whole form is hidden and is submitted in javascript using the click method of the submit input. Basically there's a map (jpg image) and the user select a tool and then select a part of the map and then some javascript set the value of the inputs of the hidden form and then click() the submit input.
 

if({selectedTool} == {aTool})
{
  {setValueOfInputsBasedOnWhichPartOfTheMapWasSelected}
         
  // Soumettre au serveur
  getChampFrameCarte("cmdCarte").click();
}

My problem is the form is never submitted in Firefox. The javascript code of the onclick event of the submit input is executed but then the form is not submitted. I can't submit the form using the submit method of the form itself cause the framework doesn't execute the java code behind if i do so. If i display the form, set some values manually without using the map and tools and then click on the submit input myself then it works. The javascript code of the onclick event of the submit input is executed and the form is submitted.

Anyone had a problem like this before? If yes what did you do? Ideally i really need to submit this form using the click method of the submit input cause i don't want to mess with the framework since i don't know this framework at all let's just say i prefer to touch the javascript only.

4 answers to this question

Recommended Posts

  • 0

Yes but i just found the solution so no reason to lol.

 

It's because the form is not displayed. When i change the form from display:none to display:block it works. I think i'll just position absolute the form and send it to left:-1000px lol ... ugly but hey that's an old ie only app they can't expect beautiful ;)

  • 0
  On 18/03/2015 at 20:37, LaP said:

Yes but i just found the solution so no reason to lol.

 

It's because the form is not displayed. When i change the form from display:none to display:block it works. I think i'll just position absolute the form and send it to left:-1000px lol ... ugly but hey that's an old ie only app they can't expect beautiful ;)

You can also try using:

<input type="hidden" />

to hide form inputs.

 

Also if it's a hidden form you can just remove the submit button and use .submit() to submit the form.

Edit: saw that it's not possible to use .submit() in your case.

This topic is now closed to further replies.
  • Posts

    • >Fixed: Certain displays might be unexpectedly green. I believe that this fixed the Windows mishandling Dolby Vision issue in RGB 12 bit Full mode we saw recently.
    • These SSDs from Crucial, SanDisk, and Western Digital are selling at great prices by Fiza Ali Amazon US is currently offering a wide range of solid‑state drives at attractive prices, covering both internal and portable options to meet diverse storage needs. So, whether you're looking to expand your laptop's storage, speed up your desktop, or carry large files on the move, these discounts make it easier to secure reliable SSD technology without exceeding your budget. The 1TB Crucial BX500 is a 2.5‑inch SATA III solid‑state drive offering a maximum interface speed of 6Gb/s. In terms of performance, the drive achieves sequential read speeds of up to 540MB/s and sequential write speeds of up to 500MB/s. It is rated for an endurance of 360TB total bytes written (TBW). 1TB Crucial BX500 Internal SSD: $56.99 (Amazon US) - 40% off The 2TB Crucial P3 Plus is an NVMe SSD in the M.2 2280 form factor, utilising a PCIe Gen 4 ×4 interface. It delivers sequential read speeds of up to 5,000MB/s and sequential write speeds of up to 4,200MB/s. Rated for 440TBW, it offers durable performance for everyday and professional use alike. 2TB Crucial P3 Plus NVMe SSD: $113.99 (Amazon US) The 4TB Crucial X10 portable SSD features a USB 3.2 Gen 2x2 interface, supporting data transfer speeds of up to 20Gb/s. The drive delivers sequential read speeds of up to 2,100MB/s, making it suitable for tasks such as video editing, file transfers, and system backups. 4TB Crucial X10 Portable SSD: $246.99 (Amazon US) - 38% off The 2TB SanDisk Extreme Portable SSD comes equipped with a USB 3.2 Gen 2 interface (backwards compatible with USB 3.0 and USB 2.0). It delivers sequential read speeds of up to 1 000 MB/s, promising rapid file transfers and game loading times. Designed, tested, and approved for use with PlayStation 5 consoles, this rugged SSD lets you archive and restore game libraries rapidly. It is IP55‑rated for water and dust resistance as well. 2TB SanDisk Extreme Portable SSD: $178.01 (Amazon US) - 26% off The 1TB Western Digital Blue SA510 SSD connects via SATA III (6Gb/s). It delivers sequential read speeds of up to 560MB/s and write speeds up to 520MB/s, with random performance rated at 90,000 IOPS for reads and 82,000 IOPS for writes. Built on WD’s 3D NAND technology, it carries a 400TBW endurance rating and is backed by a five‑year limited warranty. Finally, it operates safely between 0°C and 70°C (–55°C to 85°C when powered down). 1TB Western Digital WD Blue SA510 Internal SSD: $63.17 (Amazon US) - 26% off This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. You can also check out other SSD deals here. For hard disk drives, you can head over to our HDD deals section to see if anything from there matches your requirements. Make sure you also browse through Amazon US, Amazon UK, and Newegg US to find some other great tech deals. As an Amazon Associate, we earn from qualifying purchases.
    • Look at the fingers especially round the cups, you’d think A needs to add the I together
    • There are too many people doing nothing and just cruising at MS because of how the previous culture was (rest and vest).
  • Recent Achievements

    • Week One Done
      Wayne Robinson earned a badge
      Week One Done
    • One Month Later
      Karan Khanna earned a badge
      One Month Later
    • Week One Done
      Karan Khanna earned a badge
      Week One Done
    • First Post
      MikeK13 earned a badge
      First Post
    • Week One Done
      OHI Accounting earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      681
    2. 2
      ATLien_0
      275
    3. 3
      Michael Scrip
      207
    4. 4
      +FloatingFatMan
      172
    5. 5
      Steven P.
      143
  • Tell a friend

    Love Neowin? Tell a friend!