Hyperlink empty
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Catherine,
It should be possible, but what do you mean by empty? No value or not valid URL? By default, you can check Hyperlink on New Form or Edit Form like this:
For Display form:
But this code will only check if user added some changes or not, if user simply deletes http:// part, it wouldn't work. Let me know your exact needs and we can write better code for you.
It should be possible, but what do you mean by empty? No value or not valid URL? By default, you can check Hyperlink on New Form or Edit Form like this:
Code: Select all
if(fd.field('URL').value()[0] == 'http://'){
alert('Empty!');
}
Code: Select all
if(fd.field('URL').value()[0] == " "){
alert('Empty!');
}
Cheers
Hi,
I am trying to implement the code in the edit form using the code from this post
viewtopic.php?f=1&t=686&sid=cc6893c598c ... 5&start=10
When only http is indicated the alert is displaying, but the border not coming in red.
Do you have an idea?
Thanks
Catherine
I am trying to implement the code in the edit form using the code from this post
viewtopic.php?f=1&t=686&sid=cc6893c598c ... 5&start=10
When only http is indicated the alert is displaying, but the border not coming in red.
Do you have an idea?
Thanks
Catherine
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Catherine,
The code for single line should work just fine, although it highlights description input too. You can also try this to highlight only first line:
The code for single line should work just fine, although it highlights description input too. You can also try this to highlight only first line:
Code: Select all
var error = false;
function checkFields(){
error = false;
if(fd.field('URL').value()[0] == 'http://'){
setRedURL('URL');
}
}
function setRedURL(fieldname){
$('.fd_field[fd_name='+fieldname+'] input:first').css(
{'border-color': 'rgba(245,25,10,0.6)',
'box-shadow': '0px 0px 10px 0px rgba(245,5,90,0.8)'})
.change(function(){
self = $(this);
if (self.text){
self.css(
{'border-color': '',
'box-shadow': ''})
}
});
error = true;
}
fd.onsubmit(function(){
checkFields();
if(!error){
return true;
}
else{
alert("Please, fill in the mandatory fields!");
}
});
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests