Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
smartformhelper [2018/04/05 16:52] Manuel Kindler angelegt |
smartformhelper [2021/07/01 09:52] (aktuell) |
||
---|---|---|---|
Zeile 4: | Zeile 4: | ||
Ansammlung nützlicher Funktionen welche oftmals im Einsatz sind. Die Funktionen sind größtenteils so gehalten, dass sie bei anderen Kunden ohne viel Aufwand verwendet werden können. | Ansammlung nützlicher Funktionen welche oftmals im Einsatz sind. Die Funktionen sind größtenteils so gehalten, dass sie bei anderen Kunden ohne viel Aufwand verwendet werden können. | ||
- | Darin enthalten sind: | + | \\ |
- | + | >>Achtung: jQuery wird dringend benötigt!! | |
- | * setValue: Setzt einen Wert als Prozessvariable und befüllt ein evtl. vorhandenes Feld damit ( egal ob Input, Textarea, Radiobuttongroup, Select usw) | + | |
- | * getValue: Holt Wert für Prozessvariable. Wenn undefined wird Leerstring zurückgegeben | + | |
- | * ajaxCall: Führt Ajaxcall aus und gibt Response an eine Callback weiter (Params: Type, URL, dataType, contentType, callback) | + | |
- | * stringContains: Prüft ob Zeichenkette vars in Wert var vorhanden ist. vars kann ein String oder ein Array aus mehreren Strings sein (Params: variable1, variable(s)2) | + | |
- | * selectUsersByGroup: Füllt Dropdown mit Usern einer Gruppe oder allen TIM Usern \\ HTML: <select name="INSERT A NAME" id="INSERT AN ID" class="INSERT A CLASSNAME" group="INSERT A TIM GROUP"></select> \\ Params: classname | + | |
- | * getUserName: Returns Firstname, Lastname from user got. If undefined returns username. (Param: User) | + | |
- | * selectUsersByGroup: Fill dropdowns with all users or users from group. Exepts Classname of the dropdowns \\ HTML: <select name="INSERT A NAME" id="INSERT AN ID" class="INSERT A CLASSNAME" group="INSERT A TIM GROUP"></select> \\ Params: classname | + | |
- | * getUserName: Returns Firstname, Lastname from user got. If undefined returns username. (Param: User) | + | |
- | * getUserDepartment: Returns department of userGot (Param: user) | + | |
- | * getDateString: returns date as string in format dd.MM.yyyy (Params: Date) | + | |
- | * getTime: returns time as string in format hh:mm (Params: Date) | + | |
- | * populateSelectFromArray: fills an Selectfield with the given arrays \\ Params: id of the select \\ array: array filled plain text or objects. If objects, all attributes are taken \\ attributeList: if only certain attributes of objects should be taken | + | |
- | * populateSelectFromCSV: fills an Selectfield with the CSV File from URL \\ <select id="testSelect" csvFile= "/loom-portal/custom/test/Ressources/test.csv" csvCols="SpalteA;SpalteB" name="testSelect" class="form-control"></select> \\ ########papaparse.min.js mandatory########## \\ Params: - | + | |
- | * checkValidInput: checks if regex from field param matches. alerts message and clears field if not. Sets value on change \\ example: \\ <input type="text" name="name" id="id" regex="^\d*$" message="only digits"/> \\ checkValidInput( $(".fields") ) \\ Params: filds | + | |
- | + | ||
- | \\ >>Achtung: jQuery wird dringend benötigt!! | + | |
=== Sourcen === | === Sourcen === | ||
Zeile 34: | Zeile 18: | ||
--> | --> | ||
- | <select name="BELIEBIG" id="BELIEBIG" group="TIM Gruppe" class="BELIEBIG"> </select> | + | <select name="BELIEBIG" id="BELIEBIG" group="TIM Gruppe" class="BELIEBIG"> </select> |
<!-- | <!-- | ||
Zeile 189: | Zeile 173: | ||
value = value.toString(); | value = value.toString(); | ||
- | var identifier = idGot.replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/\?/g,"\\?"); | + | var identifier = idGot.replace(/[/g,"[").replace(/\]/g,"\\]").replace(/\?/g,"\\?"); |
var field = $("#"+identifier); | var field = $("#"+identifier); | ||