0

一旦用户按下提交,我正在尝试根据下拉列表中的选择动态更改表单更改发布操作。一旦做出选择,我已经让它工作了,但这会覆盖我的验证规则。

我正在处理的网站的网址是 instaloan.glidewebdesign.com

根据“汽车标题状态”下拉列表中的选择,我希望它根据答案提交不同的发布操作。

在此先感谢您的任何帮助!!!!!!!

function set_form_action()
{
    if (page == 'clear_title')
    {
        window.location = 'https://secure.leads360.com/Import.aspx?   Provider=TMXFinance&Client=TMXFinance&CampaignId=1034&Url=http://instaloan.glidewebdesign.com/index.php/thank-you';
    }
    else if (page == 'lien_on_title')
    {
        window.location = 'https://secure.leads360.com/Import.aspx?Provider=TMXFinance&Client=TMXFinance&CampaignId=1034&Url=http://instaloan.glidewebdesign.com/index.php/thank-you2';
    }
    else if (page == 'no_title')
    {
        window.location = 'https://secure.leads360.com/Import.aspx?Provider=TMXFinance&Client=TMXFinance&CampaignId=1034&Url=http://instaloan.glidewebdesign.com/index.php/thank-you3';
    }
}


<form name="homeform" >

            <fieldset>
                            <input name="first" type="text" class="name" placeholder="&nbsp;First Name" maxlength="10" onkeyup="checkInput2(this)" required="required" />
                            <input name="last" type="text" class="name" placeholder="&nbsp;Last Name" maxlength="15" onkeyup="checkInput2(this)" required="required" /></br>
                            <input name="phone" type='tel'    pattern='^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$' title='Phone Number (Format:  (999) 999-9999)' class="name" placeholder="&nbsp;Phone Number" maxlength="10"     onkeyup="checkInput(this)" required="required" />
                            <input name="zip" type="text"     name="zipCode" value=""
   pattern="[0-9]{5}([-][0-9]{4})?" placeholder="&nbsp;Zip Code" class="name"     maxlength="5" onkeyup="checkInput(this)" required="required"  /></br>
                            <select name="amount" class="dropdown" value="Amount Requested">
                                <option value="0">Amount</option>
                                <option value="$100-$499">$100 - $499</option>
                                <option value="$500-$999">$500 - $999</option>
                                <option value="$1000-$1999">$1,000 - $1,999</option>
                                <option value="$2000-$2999">$2,000 - $2,999</option>
                                <option value="$3000+">$3,000+</option>
                        </select>
                            </br>
                            <select name="status" class="dropdown" value="Car Title Status" >
                                <option value="smt">Car Title Status</option>
                                <option value="clear_title">I have a clear car title</option>
                                <option value="lien_on_title">There&#8242;s a lien against my car title</option>
                                <option value="no_title">I don&#8242;t have a car title</option>
                            </select>
                            </br>
                            <input name="submit" type="submit" class="submit" value="Find Out Now" />
                    </fieldset>

    </form>
4

1 回答 1

0

好的...拔掉我留下的小头发后,我明白了...我所做的完全错误,因为无论如何我都在努力完成。这是我的最终工作代码:

$("#homeform").submit(function(){
    if($("#status").val() == "clear_title"){
        $(this).attr("action","https://secure.leads360.com/Import.aspx?    Provider=TMXFinance&Client=TMXFinance&CampaignId=1034&Url=http://instaloan.glidewebdesign.co    m/index.php/thank-you");   
    }
   else if($("#status").val() == "lien_on_title"){
        $(this).attr("action","https://secure.leads360.com/Import.aspx?    Provider=TMXFinance&Client=TMXFinance&CampaignId=1034&Url=http://instaloan.glidewebdesign.co    m/index.php/thank-you2");   
    } 
    else if($("#status").val() == "no_title"){
        $(this).attr("action","https://secure.leads360.com/Import.aspx?    Provider=TMXFinance&Client=TMXFinance&CampaignId=1034&Url=http://instaloan.glidewebdesign.co    m/index.php/thank-you3");  
    }
}); 

HTML:

<form id="homeform" name="homeform" method="post" action="">

                <fieldset>
                            <input name="first" type="text" class="name" placeholder="&nbsp;First Name" maxlength="10" onkeyup="checkInput2(this)" required="required" />
                            <input name="last" type="text" class="name" placeholder="&nbsp;Last Name" maxlength="15" onkeyup="checkInput2(this)" required="required" /></br>
                            <input id="phone" name="phone" type='tel' pattern='^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$' title='Phone Number (Format: (999) 999-9999)' class="name" placeholder="&nbsp;Phone Number" maxlength="10"  required="required" />
                            <input name="zip" type="text" name="zipCode" value=""
   pattern="[0-9]{5}([-][0-9]{4})?" placeholder="&nbsp;Zip Code" class="name"     maxlength="5" onkeyup="checkInput(this)" required="required"  /></br>
                        <select name="amount" class="dropdown" value="Amount Requested">
                            <option value="0">Amount</option>
                            <option value="$100-$499">$100 - $499</option>
                            <option value="$500-$999">$500 - $999</option>
                            <option value="$1000-$1999">$1,000 - $1,999</option>
                            <option value="$2000-$2999">$2,000 - $2,999</option>
                            <option value="$3000+">$3,000+</option>
                        </select>
                        </br>
                        <select id="status" name="status" class="dropdown" value="Car Title Status" >
                            <option value="smt">Car Title Status</option>
                            <option value="clear_title">I have a clear car title</option>
                            <option value="lien_on_title">There&#8242;s a lien against my car title</option>
                            <option value="no_title">I don&#8242;t have a car title</option>
                        </select>
                        </br>
                        <input name="submit" type="submit" class="submit" value="Find Out Now" />
                </fieldset>

</form>
于 2013-01-28T19:46:07.600 回答