Programming, technology, and CRM – from a Belgian programmer exiled to Missouri
  • rss
  • Home
  • Contact Me
  • Welcome

Required textbox on Saleslogix Web Client

Nicolas Galler | May 13, 2008

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):

#if($qfcontrol.ControlId.EndsWith("_req"))
<asp:RequiredFieldValidator runat="server" Text="*" ControlToValidate="${qfcontrol.ControlId}" id="vld_${qfcontrol.ControlId}" />
#end

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.

Categories
Programming, Saleslogix
Comments rss
Comments rss
Trackback
Trackback

« Functional C# Customize the QuickForm DataGrid (toolbar buttons and double-click to edit) »

7 Responses to “Required textbox on Saleslogix Web Client”

  1. Ryan Farley says:
    May 13, 2008 at 8:44 pm

    Now that is quite a trick Nick. Pretty cool.

  2. Senthil.G says:
    June 12, 2008 at 6:45 am

    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 />
    #else
    <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=”this.select();” #end
    #if($qfcontrol.Visible == false)Visible=”false” #end
    #if($qfcontrol.HasActionCode)AutoPostBack=”true” #end />
    #if($qfcontrol.ControlId.EndsWith(”_req”))

    #end
    #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>

    #end

  3. Jerry says:
    June 12, 2008 at 7:52 am

    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 Galler says:
    June 12, 2008 at 4:25 pm

    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 Norris says:
    February 19, 2009 at 3:51 pm

    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 Norris says:
    February 20, 2009 at 8:55 am

    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 « Mark Dykun on Development, SalesLogix and General Thoughts says:
    March 6, 2009 at 7:56 am

    [...] 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 http://blog.chivinou.net/2008/05/13/required-textbox-on-saleslogix-web-client/ [...]

Leave a Reply

Click here to cancel reply.

Categories

  • Experiments (4)
  • Interesting (1)
  • MSCRM (1)
  • Programming (60)
  • Rant (3)
  • Saleslogix (34)
  • Tricks (8)
  • Uncategorized (23)

Post History

  • 2010
    • January (3)
  • 2009
    • March (2)
    • April (1)
    • May (3)
    • June (3)
    • July (1)
    • September (3)
    • October (2)
    • December (5)
  • 2008
    • January (9)
    • February (4)
    • March (9)
    • April (1)
    • May (5)
    • June (8)
    • July (1)
    • August (2)
    • September (1)
    • November (1)
    • December (3)
  • 2007
    • January (3)
    • February (7)
    • March (1)
    • April (3)
    • May (6)
    • June (2)
    • July (1)
    • August (2)
    • September (5)
    • October (3)
    • November (5)
    • December (4)
  • 2006
    • January (2)
    • September (1)
    • November (3)
    • December (4)
  • 2005
    • April (1)

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox