Form will not submit! Non-Jscript programmer needs help.

Discussion in 'Javascript' started by kheston1, Sep 19, 2007.

  1. kheston1

    kheston1 Guest


    I'm a ASP C# programmer who never uses javascript and had to try and
    move a couple of functions (written by someone else) from one page to
    another. The functions work fine, but when I copy them over they fail.
    The last message was the the "frm" object did not support the "submit"
    method. The function simply takes input from a text box and builds a
    little form that it submits to a search site. These are the simplest
    things but I can't figure it out - please help! Code is below.

    <script type="text/javascript">
    function fnSearchWebstoreDL()
    var frm = document.createElement("<head><META
    content='full'></head><form name='frmSearchFormName'></form>"); = "frmSearchFormName";
    frm.method = "GET";
    frm.action = "http://webstore/webstoresupport/simplesearch.aspx";

    var inpt = document.createElement("<input name='SearchFor'>"); = "idSearchString";
    inpt.value = document.all("txtSearchWebstoreDLFor").value;



    <label>Webstore Support:</label>
    <input id='Text1' type="text" name="txtSearchWebstoreDLFor"

    kheston1, Sep 19, 2007
    1. Advertisements

  2. kheston1

    Evertjan. Guest

    wrote on 19 sep 2007 in comp.lang.javascript:
    document.createElement() only creates a tag element,
    does not insert content, I think.

    There probably is no reliable way to add a functioning <meta>,
    after the page is loaded.

    This gives an id TO the created tag,
    does not link to a form with a name,
    even if it were created.
    Same nonsense
    Ancient code,
    use document.getElementById() or document.forms[].elements[]
    What a crap code, why the return?

    why the />?
    Is this ment to be IE only, btw?

    Try, [not tested]:

    <input type='text' onkeypress = 'fnSearchWebstoreDL(this);'>

    <script type='text/javascript'>
    function fnSearchWebstoreDL(x) {
    if (window.event.keyCode!=13) return;
    var frm = document.createElement('Form');
    // = 'frmSearchFormName'; // not used
    // frm.method = 'GET'; // default
    frm.action = 'http://webstore/webstoresupport/simplesearch.aspx';

    var inpt = document.createElement('input'); = 'SearchFor';
    inpt.value = x.value;



    or, [not tested]:

    <input type='text' onkeypress = 'fnSearchWebstoreDL(this);'>

    <script type='text/javascript'>
    function fnSearchWebstoreDL(x) {
    if(window.event.keyCode!=13) return;
    a = 'http://webstore/webstoresupport/simplesearch.aspx';
    window.location.href = a + '?SearchFor=' + x.value;

    or just use a simple html form doing all this stuf,
    [not tested]:

    <form action = "http://webstore/webstoresupport/simplesearch.aspx">
    <input name ='SearchFor'>
    Evertjan., Sep 19, 2007
    1. Advertisements

  3. That is a quite ridiculous statement as C# requires ASP.NET which in turn
    relies heavily on client-side JScript support by default.
    Maybe you should let a Web developer do the job?
    Although your code is not Valid (see,
    this is not a J(ava)Script problem. Get informed about the DOM.

    Thomas 'PointedEars' Lahn, Sep 19, 2007
  4. kheston1

    kheston1 Guest

    Hey Evertjan - thanks a million for the help! I'll try your
    suggestions immediately.

    Thomas - couldn't agree with you more. I'm a hell of a lame
    programmer. Also, you make a very good point about DOM. I do need to
    get more up to speed on that contruct. Thanks for your feedback!

    kheston1, Sep 19, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.