Small validatin improvement
This commit is contained in:
+1
-1
@@ -165,7 +165,7 @@ func main() {
|
||||
body := strings.TrimSpace(r.FormValue("body"))
|
||||
|
||||
if len(subject) > util.MAX_SUBJECT_LEN {
|
||||
http.Error(w, fmt.Sprintf("Subject exceeds %d characters", util.MAX_BODY_LEN), http.StatusBadRequest)
|
||||
http.Error(w, fmt.Sprintf("Subject exceeds %d characters", util.MAX_SUBJECT_LEN), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package shared
|
||||
import "github.com/dominicf2001/comfychan/internal/database"
|
||||
import "strings"
|
||||
import "github.com/dominicf2001/comfychan/internal/util"
|
||||
import "strconv"
|
||||
|
||||
templ NewPostForm(board database.Board, endpoint string, isForThread bool) {
|
||||
<div style="display: none;" id="newPostWarning" class="warning"></div>
|
||||
@@ -37,11 +36,11 @@ templ NewPostForm(board database.Board, endpoint string, isForThread bool) {
|
||||
class="new-post-form-field"
|
||||
>
|
||||
<th>Subject</th>
|
||||
<td><input maxlength={ strconv.Itoa(util.MAX_SUBJECT_LEN) } id="newPostSubject" name="subject"/></td>
|
||||
<td><input id="newPostSubject" name="subject"/></td>
|
||||
</tr>
|
||||
<tr class="new-post-form-field">
|
||||
<th>Comment</th>
|
||||
<td><textarea maxlength={ strconv.Itoa(util.MAX_BODY_LEN) } id="newPostBody" name="body" required></textarea></td>
|
||||
<td><textarea id="newPostBody" name="body" required></textarea></td>
|
||||
</tr>
|
||||
<tr class="new-post-form-field">
|
||||
<th>File</th>
|
||||
|
||||
Reference in New Issue
Block a user