Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CF Javascript Question

New Here ,
Mar 15, 2009 Mar 15, 2009
Hi,
I am not knowledgeable in JavaScript. Is there a way in a CF form/dropdown list to act as a "sumbit" when an item in the dropdown list is selected without an actual submit button being used? I know you can runs scripts with "onClick" - but I don't know if a JavaScript can submit a form?

Thanks in advance,
hefterr
455
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 15, 2009 Mar 15, 2009
Hi,

JavaScript can, indeed, submit a form. The (very) basic syntax goes along the lines of:
document.myformid.submit()

You can execute this expression from within a function that is called when the drop-down list is changed (i.e., an item is selected).

For more details, Google "JavaScript Submit Form"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2009 Mar 21, 2009
Yes you can use onchange event in drop down box as
<select name="dropDownName" onchange="form_submit();'"
-----
</select>

Javascript function

function form_submit()
{
document.formname.submit();
}

Hope this helps...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 22, 2009 Mar 22, 2009
LATEST
quote:

Originally posted by: hefterr
Hi,
I am not knowledgeable in JavaScript. Is there a way in a CF form/dropdown list to act as a "sumbit" when an item in the dropdown list is selected without an actual submit button being used? I know you can runs scripts with "onClick" - but I don't know if a JavaScript can submit a form?

Thanks in advance,
hefterr

Yes, but you punish people that know how to use a keyboard. You also don't give people a chance to look at what they selected before submitting the form.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources