Jump to content
deejagothic

Isu Dgn Click() Sehingga Rasa Nak Jadi Jurutol

Recommended Posts

Salam,

Aku ade buat satu form. Dalam form tu ade byk input element.
Dalam form tu ade button save dgn submit. Dalam masa yg sama, ada satu link utk ke page lain.

Bila user masukkan data kedalam input element, dan tekan save, data akan disave.
Tapi masalahnye bila dia masukkan data, tapi sblom tekan save, dia klik kat link, data yg dia key in tu tak save.

Jadi solusinya, aku buat onClick listener kat link tu. Dgn harapan yg murni, bile click link, dia akan trigger button save.

Simple je function trigger tu... doc.getelementbyid.click()! dan pada kali pertama...ia berjaya..
tapi kengkadang dia fail. (selalu jgak la fail) unless aku load page tu tanpa cache. utk kali pertama je berjaya...bile kali kedua,
tak berjaya..

Ape yg tak kene eh?

Sila beri pendapat...workaround pun buleh...aku perlukan idea!!!!!

Share this post


Link to post
Share on other sites
try guna submit()..

[code]<a href="...." onClick="document.form1.submit();">[/code]

[quote]Dalam form tu ade button save dgn submit[/quote]

ape beza button save dgn button submit? dari segi fungsinye kat form yg ko buat.. Edited by dans kam

Share this post


Link to post
Share on other sites
ko hide kan je link tu bila user cuba utk save
lepas habis save..show kan balik link tu
simple je

p/s:aku rasa dia save pki ajax tu...klu pki submit..xde nye user nak click link Edited by slier

Share this post


Link to post
Share on other sites
Camnih..
Save utk save form...submit..utk submit form tu.
Save maknanye user boleh edit lagi form tu...submit, user takleh edit dahh..

Link tu plak, utk user isi sub-form. Camtu lah lebih kurang..
Takleh hide link..requirement kene ade link..
form.submit() tu cam menarik jgak..
tunggu aku buat poc dlu..nanti ku btau result!


Terimas sarkas!!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...