I'm building a web app and there is a "contact customer service" button that will be on just about every page. So, I build a custom class for myself that will accept a subject and message as parameters, and generate the email. Code re-use FTW! Anyhow, I want to validate it (the form) client-side with javascript to ensure that a message and subject are populated before anything else.
The link itself is using the smoothbox framework that meshes well with mootools to create a nice modal form. so they click the link, modal box pops up and wants the subject and message, then click the submit button and it calls the validation. Here's the problem: Because it's modal, the two textboxes are not validating properly. I have the two boxes inside a div that has it's display properly set to none so it doesn't show up at all until the "contact" button is pressed. However, because of this, it also will never validate proeprly.
If i take the display property off, the code works perfectly, but then I also have a form always showing on my page, yuck.
- Code: Select all
' Call to modal form
<p><a href="#TB_inline?height=250&width=500&inlineId=contactCSR" title="Please fill out all fields" class="smoothbox">Contact Customer Service</a></p>
<p><asp:linkbutton id="logout" runat="server" text="Log out" onClick="logMeout" /></p>
'Form itself
<div id="contactCSR" style="display:none;">
<table>
<tr><td>Subject</td><td><asp:textbox id="contactSubject" width="350" runat="server" /></td></tr>
<tr><td valign="top">Message</td><td><asp:textbox id="contactMessage" width="350" textmode="MultiLine" height="150" runat="server" /></td></tr>
<tr><td> </td><td><asp:button id="contactSubmit" runat="server" text="submit" onClick="sendCSREmail" onClientClick="return validateCSREmail()" /></td></tr>
</table>
</div>
Above code works, validates, sends email as long as the display style isn't set. Otherwise it does not work..... any know work arounds? The form shows up and hides appropriately, I don't know why it won't validate.
