• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

[ERLEDIGT] Anführungszeichen maskieren

musclebreast

Mitglied
Hallo,

ich habe irgendwie ein problem beim maskieren der Anführungszeichen....ohne den aufruf der funktion format klappt es...kann mir jemand sagen wo genau ich einen maskierungsfehler habe?

Code:
OTModifyDate1=  "qlrangedate\""  + Format(date1, "YYYYMMDD") + "~" +dateFormat(today, "YYYYMMDD") + "\"";



als Ausgabe sollte dies kommen:

qlrangedate"20131101~20131101"


LG,

Lara
 
Werbung:
Hi,

der Fehler ist" Object expected". Ich denke, dass die Funktion "format" nicht erkannt wird. Nehme ich die Anführungszeichen raus:


Code:
OTModifyDate1=  "qlrangedate"  + Format(date1, "YYYYMMDD") + "~" +dateFormat(today, "YYYYMMDD");


funktiert es. Ich brauche nur Anführungszeichen drum herum....habt ihr nen Tipp?

LG
 
Werbung:
Schreib es mal so:

Code:
OTModifyDate1=  'qlrangedate"'  + Format(date1, "YYYYMMDD") + '~' +dateFormat(today, "YYYYMMDD") + '"';
 
HI Threadi,

es ist immer noch der selbe fehler....ich habe schon sämtliche varianten probiert...gibt es evtl. noch nen trick? evtl. es auf variaben schreiben und die zusammensetzen?
 
Werbung:
Leider nicht, weil es eine lokale Anwendung ist. Aber dies sind die entscheidenen Code Segamente:

Code:
<Script>

function dateFormat(date, format) {
    // Calculate date parts and replace instances in format string accordingly
    format = format.replace("DD", (date.getDate() < 10 ? '0' : '') + date.getDate()); // Pad with '0' if needed
    format = format.replace("MM", (date.getMonth() < 9 ? '0' : '') + (date.getMonth() + 1)); // Months are zero-based
    format = format.replace("YYYY", date.getFullYear());
    return format;
}



function search_query()

{

var query1 = "";
var location = "";
var keyword = "";
var OTModifyDate1 = "";


searchword = document.getElementById("where1").value;
location = document.getElementById("location").value;
OTModifyDate1 = document.getElementById("OTModifyDate1").value;

if (OTModifyDate1!="") { 


var today=new Date(); 


switch (OTModifyDate1)
{
case "pastday":
  var date1=new Date();
  date1.setDate(today.getDate()-1);
  break;

case "pastweek":
  
  break;

  
case "pastmonth":
  
  break;
  
case "pastyear":
  
  break; 
  
  
}



OTModifyDate1=  'qlrangedate"'  + Format(date1, "YYYYMMDD") + '~' +dateFormat(today, "YYYYMMDD") + '"';
}

 
if (location=="here") { 
    
    location=OBJECT_DATAID;

}


query1 = document.getElementById("where1").value + ' AND "OTLocation":' +location+ ' AND "OTSubType":144 AND "OTModifyDate":'+OTModifyDate1+' AND "OTMIMEType":application/pdf';


document.location = '?func=ll&objId=2082026&objAction=RunReport&Inputlabel1='+query1+'&location='+OBJECT_DATAID+'&searchword='+searchword+'&nexturl=';




}


</script>



hie das Feld auf der Seite:

Code:
 <tr>
    <td style="vertical-align: middle">
Last Modification:&nbsp;
    </td>
    <td style="vertical-align: middle">
<select name="OTModifyDate1" ID="OTModifyDate1">
<option value="">All</option>
<option value="pastday">Past day</option>
<option value="pastweek">Past week</option>
<option value="pastmonth">Past month</option>
<option value="pastyear">Past Year</option>
</select>
    </td>
  </tr>


Die Fehlerhafte Zeile ist in der funktion searchquery....Ich probiere es schon Stunden und verzweifel langsam...wieder eine typische Zeichengeschichte:)

lg
 
Das scheitert schon am Ansatz. Hier

Code:
OTModifyDate1 = document.getElementById("OTModifyDate1").value;

rufst Du einen nicht vorhandenen Wert eines select-Feldes ab. Das geht aber nicht. Wenn Du den in einem select-Feld ausgewählten Wert haben willst, musst Du mit selectedIndex arbeiten. Schau mal bei selfhtml, da gibts Beispiele dazu.

Durch diesen Fehler kann auch die Bedingung danach nicht funktionieren, und alles danach wird vermutlich mehrere Fehlermeldungen erzeugen.
 
Werbung:
Zurück
Oben