Hello All,
I’m trying to figure out why my page isn’t working; there are a few different lines of text we want to show depending on whether they are populated or not in the dataset. As far as I can tell, they should work. But for whatever reason, nothing is functioning. Along with the I named the Dataset Signature Series, but it simply does not want to hide anything. Any advice on what I’m missing?
import wixData from ‘wix-data’ ;
import wixLocation from ‘wix-location’ ;
$w . onReady ( function () {
$w ( “#SignatureSeries” ). onReady ( () => {
/***************/
**let** adu = $w ( "#SignatureSeries" ). getCurrentItem (). adu ;
**if** ( adu == "" || adu === **undefined** ){
$w ( '#text185' ). collapse ();
}
**else** {
$w ( '#text185' ). text = "ADU:" + " " + adu ;
}
/***************/
let fromHomeowner = $w ( “#SignatureSeries” ). getCurrentItem (). homeowner ;
console . log ( fromHomeowner );
**if** ( fromHomeowner === **undefined** || fromHomeowner == "" ){
$w ( '#descriptiontitle' ). collapse ();
$w ( '#text148' ). collapse ();
}
**else** {
$w ( "#descriptiontitle" ). expand ();
$w ( "#text148" ). text = fromHomeowner ;
}
/***************/
const matterportimage = $w ( “#SignatureSeries” ). getCurrentItem (). matterportImageUrl ;
const matterportlink = $w ( “#SignatureSeries” ). getCurrentItem (). matterportUrl ;
console . log ( “matterport data” + " " + matterportimage );
if ( matterportimage === undefined ) {
$w ( “#image3” ). collapse ();
$w ( “#text180” ). collapse ();
}
else {
$w ( ‘#image3’ ). src = matterportimage ;
$w ( “#image3” ). link = matterportlink ;
$w ( “#image3” ). target = “_blank” ;
}
/***************/
let airbnblink = $w ( “#SignatureSeries” ). getCurrentItem (). airbnbLinnk ;
console . log ( “airbnb link is” + " " + airbnblink );
**if** ( airbnblink == "" || airbnblink === **undefined** ){
$w ( '#text181' ). collapse ();
$w ( '#image4' ). collapse ();
}
**else** {
$w ( '#text181' ). show ();
$w ( '#image4' ). link = airbnblink ;
$w ( '#image4' ). show ();
}
/***************/
$w ( “#button15” ). onClick ( ( event ) => {
let name = $w ( ‘#input1’ ). value ;
let number = $w ( ‘#input2’ ). value ;
let email = $w ( ‘#input6’ ). value ;
let question = $w ( ‘#textBox1’ ). value ;
console . log ( name );
console . log ( number );
console . log ( email );
let toInsert = {
“name” : name ,
“phonenumber” : number ,
“question” : question ,
“email” : email
};
wixData . insert ( “CuriousCustomers” , toInsert )
. then ( ( results ) => {
let item = results ; //see item below
console . log ( “items inserted” );
resetform ();
} )
. **catch** ( ( err ) => {
**let** errorMsg = err ;
console . log ( errorMsg );
$w ( '#text184' ). show ();
} );
});
function resetform () {
$w ( ‘#text183’ ). show ();
$w ( ‘#input1’ ). value = “” ;
$w ( ‘#input2’ ). value = “” ;
$w ( ‘#input6’ ). value = “” ;
$w ( ‘#textBox1’ ). value = “” ;
}
});