Required textbox on Saleslogix Web Client
Posted By: nicocrm on May 13th, 2008 in Programming, Saleslogix
No Gravatar

Here is a quickie since I have to run… I have been banging my head against the Application Architect for a while, trying to add a “Required Field Validator” to the list of available controls. Unfortunately it looks like at this point this list is very much hard-coded in the client and I don’t feel like disassembling it (they have part of the extension points already there so it is possible that this will be available in the not so far future).

In the meantime, there is a quick’n dirty way to add a required field validator to a textbox – edit the Model\QuickForms\Web\QFTextBox.WebControlRenderingTemplate.vm file (under your web project) and add this code after the “/>” (line 25):

<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="${qfcontrol.ControlId}" id="vld_${qfcontrol.ControlId}" />

What this does is add a RequiredFieldValidator if your text box name ends in “_req”. Cheesy, but pretty handy until the “Required” flag appears on the text boxes.

7 Responses to “Required textbox on Saleslogix Web Client”

  1. Ryan FarleyNo Gravatar says:

    Now that is quite a trick Nick. Pretty cool.

  2. Senthil.GNo Gravatar says:

    As u Said, i did but i am getting error(The server tag is not well formed), whether i am missing anything. Please find below the code.

    #if(${qfcontrol.Caption} != “”)
    #if($qfcontrol.ControlLabelPlacement == “left”)
    2) colspan3#end#if(${qfcontrol.CaptionAlignment} == “right”) alignright#elseif(${qfcontrol.CaptionAlignment} == “center”) aligncenter#else alignleft#end”>
    <asp:Label ID=”${qfcontrol.LabelId}” AssociatedControlID=”${qfcontrol.ControlId}” runat=”server” Text=”" #if($qfcontrol.Visible == false)Visible=”false” #end>

    #elseif($qfcontrol.ControlLabelPlacement == “top”)

    <asp:Label ID=”${qfcontrol.LabelId}” AssociatedControlID=”${qfcontrol.ControlId}” runat=”server” Text=”" #if($qfcontrol.Visible == false)Visible=”false” #end>

    #end #end
    1 || ${qfcontrol.ControlLabelPlacement} == “top”) class=”twocoltextcontrol” #else class=”textcontrol” #end >
    #if($IsPrintView)<asp:Label runat=”server” ID=”$qfcontrol.ControlId” style=”white-space:normal” #if($qfcontrol.Text != “”)Text=”" #end />
    <asp:TextBox runat=”server” ID=”$qfcontrol.ControlId” #if(!$qfcontrol.Enabled)Enabled=”false” #end
    #if($qfcontrol.IsReadOnly)ReadOnly=”true” #end
    #if($qfcontrol.Text != “”)Text=”" #end
    #if($qfcontrol.Multiline)TextMode=”MultiLine” Columns=”40″ Rows=”4″ #end
    #if($qfcontrol.ToolTip != “”)ToolTip=”" #end
    #if($qfcontrol.HotKey != “”)AccessKey=”$qfcontrol.HotKey” #end
    #if($qfcontrol.MaxLength > 0)MaxLength=”$qfcontrol.MaxLength” #end
    #if($qfcontrol.TabIndex > 0)TabIndex=”$qfcontrol.TabIndex” #end
    #if($qfcontrol.StyleScheme != “”)CssClass=”$qfcontrol.StyleScheme” #end
    #if($qfcontrol.SelectTextOnEnter)onfocus=”;” #end
    #if($qfcontrol.Visible == false)Visible=”false” #end
    #if($qfcontrol.HasActionCode)AutoPostBack=”true” #end />


    #if((${qfcontrol.Caption} != “”) && ($qfcontrol.ControlLabelPlacement == “right”))

    <asp:Label ID=”${qfcontrol.LabelId}” AssociatedControlID=”${qfcontrol.ControlId}” runat=”server” Text=”" #if($qfcontrol.Visible == false)Visible=”false” #end>


  3. JerryNo Gravatar says:

    Nick, I have added this code to exactly the place that you have specified. But when i run the page which has the control named ‘name_req”, it says ‘Server Tag not well formed’ and doesn’t display the page.

    Pls help.

  4. Nicolas GallerNo Gravatar says:

    Hi, Sen and Jerry,
    It can be pretty picky about the placement. Can you take a look in the ascx file that gets generated? You should have some code similar to this:
    <asp:TextBox runat=”server” ID=”txtName_req” MaxLength=”128″ />
    <asp:RequiredFieldValidator runat=”server” Text=”*” ControlToValidate=”txtName_req” id=”vld_txtName_req” />

    So if you see that the closing tags are not in the right place that is the problem.

    I put the whole file here if you would like to try comparing: QFTextBox.WebControls.txt (you’ll have to rename to xml).

  5. Andy NorrisNo Gravatar says:

    I have this customization working on the Ticket screen, but I seem to have an issue with the generated PrintPreview screen showing the exclamation icon next to the fields I have being validated on the entry screen. Has anyone else seen that happen?

  6. Andy NorrisNo Gravatar says:

    Actually, scratch that previous comment. The problem I was seeing was related to a similar hack that I got from customerfx….

  7. [...] Editing Control Templates I had to add some required field validation around some of the input fields in project I am working on. Nicholas Galler provided an excellent method in his blog at [...]

Leave a Reply