Hello,
another issue I am facing that is more likely due to my lack of understanding and density.
Scenario:
A user writes a review.
Below the review, there is a rating system in the form of radio buttons.
The rating consists of five options - rating from 1-5.
The default radio button is zero/0, so as to imply to the user that he is to give a rating > 0.
My problem is ... how can I make it so that a user who forgets or fails to add his rating (with a value between 1 and 5) to his review is given an error message, forcing him to complement his review with a rating value greater than zero since zero is the default but ultimately not an allowed value?
As for code, it currently looks something like this:
{if logged_out}
<p><label for="review">Your E-Mail: </label><input type="text" name="email" value=""></p>
<p><label for="review">Your Name: </label><input type="text" name="name" value=""></p>
{/if}
<p>Submit the word you see below:</p>
<p>
{captcha}
<br />
<input type="text" name="captcha" value="" size="20" maxlength="20" style="width:140px;" /></p>
<p><textarea name="review" rows="10" cols="64"></textarea></p>
<p><label for="review">Your Vendor Rating:</label>
<input type="radio" name="rating" value="0" select="selected"><label> 0</label>
<input type="radio" name="rating" value="1"><label> 1</label>
<input type="radio" name="rating" value="2"><label> 2</label>
<input type="radio" name="rating" value="3"><label> 3</label>
<input type="radio" name="rating" value="4"><label> 4</label>
<input type="radio" name="rating" value="5"><label> 5</label>
</p>
I guess it would be some kind of conditional like, “if the value is 0, output error message, else let it pass”. But how would I translate this into working code?
Any pointers greatly appreciated.
Edit: Geez, form validation is the keyword, DAMNIT! Now I just need to figure out how to get it to work.
