Hi guys,
How to call SWAL popup using Field Events to show message when user is typing and verify subdomain availability? I already add event "editing". The message will appear if PHP gethostbyname can verify a subdomain is already existed and return 1, then in the CLIENT AFTER tab, it should verify the $result value and CALL a popup message/tootltip.
When I run this code nothing happened. If I echo $domain value, I get the right value and $result return 1/0(but this echo shows the domain/result on top of the page with "Server error occurred. See details" and when I clicked "See details" I can see the value echo.
What I did wrong?
This is the coding I put for the Field Events for a text field
**CLIENT BEFORE***
params["value"] = this.getValue();
**SERVER***
$domain = $params["value"].'.orange.com';
if ( gethostbyname($domain) != $domain ) {
$result = 1;
}
else {
$result = 0;
}
**CLIENT AFTER*****
if ( $result == 0 ) {
ctrl.setTooltip("Not Available!");
swal("Not Available!");
}
else {
ctrl.setTooltip("Available");
swal("Available");
}
I also try using this code snippet but it just get verified upon page loading
if ( $result != 0 ) {
echo '<span class="label label-danger">Not Available</span>';
}
else {
echo '<span class="label label-success">Available</span>';
}
I want to show "Available" green under the field real time.