You need to sign in to do that
Don't have an account?
Indoberto Lerma
2 functions on submit
Hi,
i am creating a visualforce page and on this page i need to concatenate fields and also make them required.
So far i was able to do both things, but i havent been able to acomplish both at the same time. i am using myfunction concatenate and validateform. how can i asociate both on the onsubmit button?
this is the code i have for both functions.
<form action="https://cs19.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST" onsubmit="myFunction()" >
<script>
function validateForm()
{
var a=document.forms["webtocase"]["name"].value;
if (a==null || a=="")
{
alert("Nombre de usuario no puede dejarse en blanco"); return false; }
</script>
<script>
function myFunction()
{
var str5 = "New Hire"; var str3 = "Nombre: " + document.getElementById("name").value + '\r\n';
var str1 = document.getElementById("email").value + '\r\n';
var str2 = document.getElementById("phone").value + '\r\n';
var str4 = document.getElementById("subject").value;
var res = str5.concat(str3, str1, str2, str4);
document.getElementById("description").innerHTML=res;
}
</script>
Description:<textarea id="description" name="description" rows="15" type="text" wrap="soft" ></textarea><br/>
<input type="hidden" id="external" name="external" value="1" /><br/>
<input type="submit" name="submit" onsubmit="myFunction()"/>
</form>
i am creating a visualforce page and on this page i need to concatenate fields and also make them required.
So far i was able to do both things, but i havent been able to acomplish both at the same time. i am using myfunction concatenate and validateform. how can i asociate both on the onsubmit button?
this is the code i have for both functions.
<form action="https://cs19.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST" onsubmit="myFunction()" >
<script>
function validateForm()
{
var a=document.forms["webtocase"]["name"].value;
if (a==null || a=="")
{
alert("Nombre de usuario no puede dejarse en blanco"); return false; }
</script>
<script>
function myFunction()
{
var str5 = "New Hire"; var str3 = "Nombre: " + document.getElementById("name").value + '\r\n';
var str1 = document.getElementById("email").value + '\r\n';
var str2 = document.getElementById("phone").value + '\r\n';
var str4 = document.getElementById("subject").value;
var res = str5.concat(str3, str1, str2, str4);
document.getElementById("description").innerHTML=res;
}
</script>
Description:<textarea id="description" name="description" rows="15" type="text" wrap="soft" ></textarea><br/>
<input type="hidden" id="external" name="external" value="1" /><br/>
<input type="submit" name="submit" onsubmit="myFunction()"/>
</form>
You can call both method in single method and check.
-Thanks
Ashlekh Gera
form action="https://cs19.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST" onsubmit="myFunction()" >
<script>
function myFunction()
{
var str5 = "New Hire"; var str3 = "Nombre: " + document.getElementById("name").value + '\r\n';
var str1 = document.getElementById("email").value + '\r\n';
var str2 = document.getElementById("phone").value + '\r\n';
var str4 = document.getElementById("subject").value;
var res = str5.concat(str3, str1, str2, str4);
document.getElementById("description").innerHTML=res;
var a=document.forms["webtocase"]["name"].value;
if (a==null || a=="")
{
alert("Nombre de usuario no puede dejarse en blanco"); return false; }
}
</script>
Description:<textarea id="description" name="description" rows="15" type="text" wrap="soft" ></textarea><br/>
<input type="hidden" id="external" name="external" value="1" /><br/>
<input type="submit" name="submit" onsubmit="myFunction()"/>
</form>