Skip to main content
Known Participant
March 15, 2009
Question

CF Javascript Question

  • March 15, 2009
  • 3 replies
  • 486 views
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
    This topic has been closed for replies.

    3 replies

    Inspiring
    March 22, 2009
    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.
    Participating Frequently
    March 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...
    Inspiring
    March 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"