zondag 15 april 2012

Check if Rich TextField is Empty


Last week I had some problems to do a check wether a Rich Text Box is filled in or not. 
When doing a check on the Text propertie of the TextField, 
I found out that Sharepoint puts default something in the TextField. 

Like it or not, but it's really frustrating that you can't use the JQuery test .isEmpty().
So after some testing, I found out that Sharepoint puts a Paragraph tag in the TextField. 
So here under you can found out how I did the check wether a Rich TextField is filled in or not. 
 

if( ($(ctl00_m_g_6e043a15_d2d5_4e91_a8c6_562e51fe3b46_ff121_ctl00_ctl00_TextField_inplacerte).text() == "") || ($(ctl00_m_g_6e043a15_d2d5_4e91_a8c6_562e51fe3b46_ff121_ctl00_ctl00_TextField_inplacerte).html() == "

?

") ) { alert('Please fill in the Rich Text box field !'); return false; }

Geen opmerkingen:

Een reactie posten