Fix number field validation: strip text from numeric answers
Number inputs (type="number") were getting answers like "5 years" instead of "5", causing LinkedIn validation errors. Now: - AI gets "(must be a number, no text or units)" hint - Answers are stripped to digits before filling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -568,12 +568,18 @@ Answer:`;
|
||||
continue;
|
||||
}
|
||||
|
||||
const formatHint = field.placeholder ? `(format: ${field.placeholder})` : '';
|
||||
let formatHint = field.placeholder ? `(format: ${field.placeholder})` : '';
|
||||
if (field.type === 'number') formatHint = '(must be a number, no text or units)';
|
||||
let answer = this.answerFor(lbl);
|
||||
if (!answer && field.required) {
|
||||
answer = await this.aiAnswerFor(formatHint ? `${lbl} ${formatHint}` : lbl);
|
||||
if (answer) this.saveAnswer(lbl, answer);
|
||||
}
|
||||
// For number fields, extract just the numeric value
|
||||
if (answer && field.type === 'number') {
|
||||
const num = String(answer).replace(/[^\d.]/g, '');
|
||||
if (num) answer = num;
|
||||
}
|
||||
if (answer && answer !== this.profile.cover_letter) {
|
||||
const el = await byTag(field.tag);
|
||||
if (!el) continue;
|
||||
|
||||
Reference in New Issue
Block a user