An action to rescind a contract for fraud is an action on the contract for purposes of Civil Code 1717.  Section 1717 is not limited to actions for breach of contract or seeking to enforce the contract.  A party is entitled to attorney fees under section 1717 even when the party prevails on grounds the contract is inapplicable, invalid, unenforceable or nonexistent, if the other party would have been entitled to attorney’s fees had it prevailed.  Furthermore, since a 1983 amendment section 1717(a) has provided that parties may not limit recovery of attorney fees to a particular type of claim unless each party was represented by counsel in the negotiation and execution of the contract, and the fact of that representation is specified in the contract.  Here, plaintiff was not represented by counsel when she supposedly entered into the contract so the limitation of its fee clause to foreclosure actions by the defendant was unenforceable.  If the prevailing party, plaintiff could, therefore, collect fees since her action was one on the contract.