You need to sign in to do that
Don't have an account?
Alert box by script
Hi,This is swamy...am getting small doubt ..just clear it plz....
am writing a small v.f ....in that some "validation" is given by script...i.e.,if name ==null ...it shows an error by alert box....but it's not workin...Can you justify this.....
Script:
<script type="text/javascript">
var val1=document.getElementById("{!$Component.name_select}").value
alert(val1)
function btn(){
if(document.getElementById('name_select').value=="")
{
alert('Please fill all the data ');
}
}
</script
v.f:
<apex:inputtext value="{!nameVal}" id="name_select"/>
<apex:commandButton value="INSERT" style="color:red;" action="{!doInsert}" onclick="btn();"/>
use the same: {!$Component.name_select} in the btn function as you did in the first part of the JS you posted
i didn't understood wat us said....
sorry...it's not working..................
use the below code to check your validation.
Script:
v.f: if you find this helpful mark it as the best answer.
thanks
Malika Pathak.