Technical support This forum is closed.
Version 1.x > Technical support > Form Action View modes: 
User avatar
Guest
rhavlick - 10/10/2006 3:55:09 AM
   
Form Action
Hello,

We are using version 1.8.2181 and I'm trying to put a form on my page that is generated via a javascript. It appears that every time I run the code, it changes the form's action from the URL I'm specifing to the URL of the actual page. It does a string replace I imagine. Is there any way around this?

Thanks.


User avatar
Guest
admin - 10/10/2006 11:18:25 AM
   
Re: Form Action
Hello,

could you please post your JavaScript code here?

Thank you.

Best Regards,

User avatar
Member
Member
RHavlick - 10/10/2006 4:00:58 PM
   
Re: Form Action
Hello,

I included the full script, and near the bottom commented out the line to highlight the form action property that is getting replaced to the form's address. Any help is greatly appreciated.

Thanks.

Ryan



<!-- initialize the linked to the Lifeline linkID and sPresence to the empty string -->
<SCRIPT language=JavaScript type=text/JavaScript>
var linkID="alsirjv2m9";
var sPresence="";
</SCRIPT>

<!-- set sPresence (NOTE: The link ID is coded into the URL) -->
<SCRIPT src='http://asap2.convoq.com/ASAPLinks/Presence.aspx?l=alsirjv2m9&style=textjsvar'></SCRIPT>

<!-- add 4 functions for calling the Lifeline link request and submitting the form -->
<SCRIPT language=JavaScript type=text/JavaScript>
/* Optional: validates the email address format */
function isValidEmail(emailad) {
var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
var check=/@[\w\-]+\./;
var checkend=/\.[a-zA-Z]{2,4}$/;
if(((emailad.search(exclude) != -1) ||
(emailad.search(check)) == -1) ||
(emailad.search(checkend) == -1)){
return false;
} else {
return true;
}
}

/* Optional: validates that the name and email address fields are filled out */
function validate() {
var errorMessage = "Please fix the following errors: \n\n";
var errorFound = 0;
if (document.caseform.n.value.length == 0) {
errorMessage += "Enter your Name\n";
errorFound = 1;
}
if (!isValidEmail(document.caseform.e.value)) {
errorMessage += "Enter a Valid Email Address\n";
errorFound = 1;
}
if (errorFound == 1) {
alert(errorMessage);
return false;
} else {
//Here was can adjust the meeting parameters:
//m is Private Message
document.caseform.m.value = "Request" + unescape("%0A") + "Name: " + document.caseform.n.value + unescape("%0A") + "E-Mail: " + document.caseform.e.value + unescape("%0A") + "Issue: " + document.caseform.Issue.value;
//S is the Public Message/Subject
document.caseform.s.value = "Request:" + unescape("%0A") + document.caseform.Issue.value.substring(0,49) + "...";
return true;
}
}

</SCRIPT>

<!--Now, only show the form if the resource is available -->
<SCRIPT>
if (sPresence=='Available')
{
document.write ('Please complete the below form to begin live technical support:');





<!-- THIS BELOW ACTION IS WHAT IS BEING REPLACED -->
document.write ('<FORM target="new" name="caseform" onSubmit="return validate();" ACTION="http://asap2.convoq.com/asaplinks/contacting.aspx" METHOD=GET>');
document.write ('<INPUT TYPE=HIDDEN NAME="l" VALUE="alsirjv2m9">');
document.write ('<INPUT TYPE=HIDDEN NAME="rw" VALUE="0">');
document.write ('<INPUT TYPE=HIDDEN NAME="m" VALUE="">');
document.write ('<INPUT TYPE=HIDDEN NAME="s" VALUE="">');
document.write ('<BLOCKQUOTE><TABLE>');
document.write ('<TR><TD>Your Name:</TD><TD><INPUT TYPE="TEXT" NAME="n" SIZE="30" VALUE=""></TD></TR>');
document.write ('<TR><TD>Email Address:</TD><TD><INPUT TYPE="TEXT" NAME="e" SIZE="30" VALUE=""></TD></TR>');
document.write ('<TR><TD>Question:</TD><TD><TextArea NAME="Issue" ROWS="5" COLS="30"></TEXTAREA></TD></TR>');
document.write ('<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=SUBMIT VALUE="Begin"></TD></TR>');
document.write ('</TABLE></BLOCKQUOTE></FORM>');
document.write (' ');
document.write (' ');
document.write (' ');
}
else
{
document.write('Currently there are no available agents to assist you. Please email us at: <a href="mailto:support@rehabsoftware.com">support@domain.com</a> and will get back to you as soon as possible.');
}
</SCRIPT>

User avatar
Member
Member
trint99 - 10/11/2006 3:57:02 PM
   
Re: Form Action
If this script occurs within an aspx page, it's likely that you are generating a form nested within the aspx form.

You could have the javascript generate the fields needed but no form tag. Then rather than doing onSubmit and a submit button, use a regular button that calls the function onClick and have the function set the action of document.forms[0] and submit that form.

Just a thought.

<input name="n">
<input name="e">
<input type="button" onclick="validate()">

...

function validate()
{
...
...
if (errorFound == 1) {
alert(errorMessage);
return false;
} else {
...
...
document.forms[0].action = "contacting.aspx";
document.forms[0].submit();
}

User avatar
Guest
admin - 10/13/2006 3:05:32 PM
   
Re: Form Action
Hello,

This is caused by the output filter that fixes the URL action of the <form> element. This fixes Microsoft's bug in the URL rewriting process.

You should have only single <form> element in the ASPX page. I would recommend that you try what trint99 suggests below.

Best Regards,

User avatar
Guest
rhavlick - 10/16/2006 5:58:27 AM
   
Re: Form Action
Cool thanks guys, I actually ended up finding another way around the problem, but I'm still stuck with this URL re-writing issue. I'm modifing a site that is integrating with SalesForce which ends up requiring you to setup forms that posts to their site. I can't get the BizForms to redirect the post to another Address, and I can't do the form inside of a form. Is there any other way to do something simple like this inside of my page:

<form action="http://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
First Name: <input type="text" name="firstname">
<input type="submit">
</form>

Thanks.


User avatar
Guest
admin - 10/16/2006 4:08:17 PM
   
Re: Form Action
Well, you could possibly try to add a script like this to your page:

document.forms[0].action = "http://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8";

It will ensure that the form action is set back to salesforce.com. However, we haven't tested this option.

Regards,